이름이 'default'인 Android Studio Gradle 구성을 찾을 수 없습니다
Android Studio (0.1.5)로 앱을 컴파일하는 데 문제가 있습니다. 응용 프로그램은 다음과 같이 포함 된 2 개의 라이브러리를 사용합니다.
settings.gradle
include ':myapp',':library',':android-ColorPickerPreference'
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
compile project(':library')
compile project(':android-ColorPickerPreference')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
컴파일 할 때이 메시지가 나타납니다.
Gradle: A problem occurred configuring project ':myapp'.
> Failed to notify project evaluation listener.
> Configuration with name 'default' not found.
이 메시지를 좀 도와 주시겠습니까? 감사!
내 경우에는로 컴파일 한 후 gradle tasks --info
로그가있었습니다.
빈 빌드 파일을 사용하여 프로젝트 ': libraries : VolleyLibrary'를 평가 중입니다.
그래서 라이브러리의 build.gradle 파일을 찾지 못했습니다. 이유는 폴더 구조입니다.
그것은이었다
-libraries
--volley
---VolleyLibrary
되어야한다
-libraries
--VolleyLibrary
모든 하위 모듈을 가져 오는 것을 잊었습니다. 그래서 나의
compile project(':something')
해결할 수 없습니다.
해결책
git submodule update --init
compile fileTree(dir: '//you libraries location//', include: ['android-ColorPickerPreference'])
앱의 gradle 파일 에서 위의 줄을 대신 사용하십시오.
compile project(':android-ColorPickerPreference')
그것이 도움이되기를 바랍니다.
다음 절차에 따라 문제가 해결되었습니다.
- 하위 프로젝트 모듈 / 라이브러리 모듈 설정으로 이동하십시오. ( F4모듈을 선택한 후 누르십시오 )
- 추가> Android-Gradle을 마우스 오른쪽 단추로 클릭하십시오 .
- 모듈에 build.gradle을 추가하십시오.
다음 스크립트를 추가하십시오
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } } apply plugin: 'android-library' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.1.0" defaultConfig { minSdkVersion 10 targetSdkVersion 18 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } } }
include ':yourModuleName'
설정에 추가 하십시오.
나는 또한이 오류에 직면했습니다-라이브러리 프로젝트 용 build.gradle 스크립트를 만드는 것을 잊었습니다.
또 다른 원인-settings.gradle을 사용하여 모듈을 포함하려고했습니다.
include ':MyModule'
project(':MyModule').projectDir = new File(settingsDir, '../../MyModule')
단지 문제는 방금 Eclipse에서 모듈을 가져 와서 디렉토리를 내 응용 프로그램 프로젝트 외부로 옮기는 것을 잊어 버렸습니다. 즉, 경로 '../../MyModule'
가 존재하지 않았습니다.
내 솔루션은 settings.gradle 파일에서 존재하지 않는 모듈을 나타내는 행을 간단히 제거하는 것입니다.
include ':somesdk'
기본 프로젝트의 build.gradle에서 해당 줄을 제거하십시오.
compile project(':somesdk')
I had a git submodule problem when getting this error. Try running gradle tasks --info
for a more detailed problem description. I first used gradle tasks --debug
, which was not nearly as helpful as --info
.
Suppose you want to add a library (for example MyLib) to your project, You should follow these steps:
- Prepare your library as a gradle Android library if your library's type is Eclipse ADT
For this job it's enough to import it in Android Studio - Copy your library folder, in this case MyLib folder, and paste it in your main project folder. It's a good practice to create a new folder in your main project folder and name it Libraries
- Go to Android Studio and open Settings.gradle file, there you should include your library in your main project. For example
include ':MyPrj', 'Libraries:MyLib'
. Note: Current directory for this include statement is your main project folder. If you paste your project into a folder you must mention it's address relative to the main project directory. In my case I paste MyLib into Libraries folder. This Libraries name is not a keyword and you can choose other names for it - Open your Project Structure page(File->Project Structure...) click on modules then click on your main project go to dependencies tab click on
+
then choose Module dependency and there is your libraries and you can select them as you want
Hope it help
In my case I was using Gradle files that work under Windows but failed on Linux. The include ':SomeProject'
and compile project(':SomeProject')
were case sensitive and were not found.
For me folder was missing which was declared under settings.gradle.
Everything looks fine at first blush, but some poking around on here found an answer that could be helpful: https://stackoverflow.com/a/16905808/7944
Even the original answer writer doesn't sound super confident, but it's worth following up on. Also, you didn't say anything about your directory structure and so I'm assuming it's boring default stuff, but can't know for sure.
One other potential cause of this precise error: I found this error was resolved by commenting some unused libraries in build.gradle dependencies section. Make sure these paths and such are all correct.
I'd look real close at your compile project(':android-ColorPickerPreference') entry in the build.gradle - try commenting out the related code and this line in build.gradle and see if that compiles - then go from there resolving the path or library issue.
I had similar issue and found very simple way to add a library to the project.
- Create folder "libs" in the root of your project.
- Copy JAR file into that folder.
- Go back to Android Studio, locate your JAR file and right click it, choose "Add As Library...", it will ask you only to which module you want to add it, well choose "app".
Now in your "app" module you can use classes from that JAR, it will be able to locate and add "import" declarations automatically and compile just okay. The only issue might be is that it adds dependency with absolute path like:
compile files('/home/user/proj/theproj/libs/thelib-1.2.3.jar')
in your "app/build.gradle".
Hope that helps!
I solved this issue by fixing some paths in settings.gradle as shown below:
include ':project-external-module'
project(':project-external-module').projectDir = file('/project/wrong/path')
I was including an external module to my project and had the wrong path for it.
I had this issue when I manually pasted google-play-services_lib into my project. Obviously, play-services didn't have a build.gradle file in it. The solution, I learned, is to put this dependency in my project's build.gradle (instead of hard-copying the play-services directory):
compile 'com.google.android.gms:play-services:4.0.+'
When i import my library manually i had same issue. I tried to add my library with file > import module and it solved my issue.
In my case I received this error when I misspelled the module name of the library (dependency) in build.gradle
file.
So remember to check if the name of the module is correct.
build.gradle
dependencies {
compile project(':module-name-of-the-library')
}
I recently encountered this error when I refereneced a project that was initiliazed via a git submodule.
I ended up finding out that the root build.gradle
file of the submodule (a java project) did not have the java plugin applied at the root level.
It only had
apply plugin: 'idea'
I added the java plugin:
apply plugin: 'idea'
apply plugin: 'java'
Once I applied the java plugin the 'default not found' message disappeared and the build succeeded.
Also... check if you have the module files inside your project.
For example, I have an app which uses the Volley module. During my studies on Android development, I accidentally removed the files which were inside the "volley" directory..
~/git/Sandbox/android/HelloWorld/volley $ ll
total 8
drwxrwxr-x 2 ivanleon ivanleon 4096 Jun 16 22:26 ./
drwxrwxr-x 6 ivanleon ivanleon 4096 Jun 17 01:51 ../
I just cloned the project (see bellow) and then, I made the Sync of the project at Android Studio (Tools > Android > Sync Project with Gradle Files), and Gradle build finished normally (Gradle Console: bottom right corner of Android Studio) ;).
~/git/Sandbox/android/HelloWorld/volley $ git clone https://android.googlesource.com/platform/frameworks/volley
Cloning into 'volley'...
remote: Counting objects: 164, done
remote: Finding sources: 100% (164/164)
remote: Total 3222 (delta 307), reused 3222 (delta 307)
Receiving objects: 100% (3222/3222), 1.22 MiB | 114.00 KiB/s, done.
Resolving deltas: 100% (307/307), done.
Checking connectivity... done.
~/git/Sandbox/android/AndroidGetJSON $ ls volley
Android.mk build build.xml pom.xml
proguard-project.txt src bintray.gradle build.gradle
custom_rules.xml proguard.cfg rules.gradle volley.iml
Your build.gradle for the module/library could be as simple as:
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
If your module is just a collection of .java POJO classes.
If it's model / entity classes and you're using annotations and have some dependencies you could add those in:
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
repositories {
mavenCentral()
}
dependencies {
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.j256.ormlite:ormlite-jdbc:4.48'
}
This happens when you are compiling imported or copied folder/project as module in libraries folder. This issue was raising when I did not include the build.gradle
file. when I added the file all went just fine.
For me it turned out to be an relative symbolic link (to the referenced project) that couldn't be used by grade. (I was referencing a library). Thats a pretty edgy edge-case but maybe it helps someone in the future.
I solved it by putting a absolute symbolic link.
Before ln -s ../library
after ln -s /the/full/path/to/the/library
I also faced the same issue and it resolved by changing one flag (gradle.ext.set("allowLocalEdits", true)) to false in settings.xml.
For me, one of dependent library does not exist in correct path, but the error message does not point THAT library correctly.
For example, what I missed is :library-3
but the error throws at :library-1
.
poor gradle.
Try adding Volley library and sync and run the program. if one has pulled and i has volley usage and the error shows as -Android Studio Gradle Configuration with name 'default' not found then follow the step of adding the volley library in your gradle. hope it helps. I cleared my problem this way.
'Programming' 카테고리의 다른 글
데이터베이스 대신 데이터 저장소에서 생각하는 방법? (0) | 2020.05.18 |
---|---|
data.table이 다른 데이터에 대한 참조 인 경우를 정확히 이해하십시오. (0) | 2020.05.18 |
다국어 데이터베이스 디자인에 대한 모범 사례는 무엇입니까? (0) | 2020.05.18 |
정적 키워드와 C ++에서의 다양한 용도 (0) | 2020.05.18 |
브라우저 뒤로 버튼 이벤트를 감지하는 방법-크로스 브라우저 (0) | 2020.05.18 |