오류 : Android Studio에서 이름이 'default'인 구성을 찾을 수 없습니다
발리 라이브러리를 사용하여 안드로이드에서 네트워크 작업을 수행하고 있습니다. 그래서 Android Studio 및 gradle 시스템에서 생성 된 프로젝트 에이 라이브러리를 추가하려고합니다.
프로젝트에 발리 라이브러리를 추가했지만 gradle과 동기화하면 오류 메시지가 나타납니다. 나는 여기에 보이는 모든 대답을 시도했지만 아무것도 효과가 없었습니다.
오류 메시지 : Android Studio에서 이름이 'default'인 구성을 찾을 수 없습니다
발리 / build.gradle
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
sourceSets {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
}
main {
assets.srcDirs = ['assets']
res.srcDirs = ['res']
aidl.srcDirs = ['src']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
java.srcDirs = ['src']
manifest.srcFile 'AndroidManifest.xml'
}
}
}
app / build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile project(':library:volley')
}
root / build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.1'
}
}
allprojects {
repositories {
mavenCentral()
}
}
settings.gradle
include ':app'
include ':library:volley'
프로젝트의 루트 위치에 라이브러리 폴더를 추가하고 여기에 모든 라이브러리 파일을 복사하십시오. 예를 들어 YourProject / library의 경우 동기화하고 나머지는 괜찮습니다.
시험:
git submodule init
git submodule update
This is probably a rare case, but for me a library that was included in the settings.gradle was not there.
E.g. I had: include ':libraries:Android-RateThisApp:library'
in my settings.gradle
but the folder Android-RateThisApp was empty. As soon as I checked out this submodule the gradle sync succeed.
If you want to use the same library folder for several projects, you can reference it in gradle to an external location like this:
settings.gradle:
include 'app', ':volley'
project(':volley').projectDir = new File('../libraries/volley')
in your app build.gradle
dependencies {
...
compile project(':volley')
...}
I also facing this issue but i follow the following steps:-- 1) I add module(Library) to a particular folder name ThirdPartyLib
To resolve this issue i go settings.gradle than just add follwing:-
project(':').projectDir = new File('ThirdPartyLib/')
:- is module name...
To diagnose this error quickly drop to a terminal or use the terminal built into Android Studio (accessible on in bottom status bar). Change to the main directory for your PROJECT (where settings.gradle
is located).
1.) Check to make sure your settings.gradle
includes the subproject. Something like this. This ensures your multi-project build knows about your library sub-project.
include ':apps:App1', ':apps:App2', ':library:Lib1'
Where the text between the colons are sub-directories.
2.) Run the following gradle command just see if Gradle can give you a list of tasks for the library. Use the same qualifier in the settings.gradle
definition. This will uncover issues with the Library build script in isolation.
./gradlew :library:Lib1:tasks --info
3.) Make sure the output from the last step listed an "assembleDefault" task. If it didn't make sure the Library is including the Android Library plugin in build.gradle
. Like this at the very top.
apply plugin: 'com.android.library'
I know the original poster's question was answered but I believe the answer has evolved over the past year and I think there are multiple reasons for the error. I think this resolution flow should assist those who run into the various issues.
Check the settings.gradle
file. The modules which are included may be missing or in another directory. For instance, with below line in settings.gradle
, gradle searches common-lib
module inside your project directory:
include ':common-lib'
If it is missing, you can find and copy this module into your project or reference its path in settings.gradle
file:
include ':common-lib'
project(':common-lib').projectDir = new File('<path to your module i.e. C://Libraries/common-lib>') //
For me, (as per some comments I have seen), the issue was that gradle could not find the build.gradle for the imported library. This configuration is straight-forward but the error message is a bit cryptic. For instance I was using the android-map-utils project and had to include it in my settings.gradle by appending these 2 lines like this.
include ':android-map-utils'
project(':android-map-utils').projectDir = new File(settingsDir, '..\\..\\modules\\android-maps-utils-master\\library')
Path of the library is relative to the my project's settings.gradle file. Then, I simply referenced it in my dependencies of my app's build.gradle file like this
...
dependencies {
....
compile project(':android-map-utils')
....
}
I recommend importing one module at a time, compiling and checking it.
If suppose you spotted this error after removing certain node modules, ideally should not be present the library under build.gradle(Module:app) . It can be removed manually and sync the project again.
I also faced the same problem and the problem was that the libraries were missing in some of the following files.
settings.gradle, app/build.gradle, package.json, MainApplication.java
Suppose the library is react-native-vector-icons then it should be mentioned in following files;
In app/build.gradle file under dependencies section add:
compile project(':react-native-vector-icons')
In settings.gradle file under android folder, add the following:
include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
In MainApplication.java, add the following:
Import the dependency: import com.oblador.vectoricons.VectorIconsPackage;
and then add: new VectorIconsPackage() in getPackages() method.
Removing few react-native dependencies solved the problem
Deleting these lines the problem is resolved. This line is created by rnpm link but is a bug.
compile project(':react-native-gps')
compile project(':react-native-maps')
'Programming' 카테고리의 다른 글
qmake : ''Qt 설치를 찾을 수 없습니다 (0) | 2020.07.18 |
---|---|
C 동적으로 성장하는 배열 (0) | 2020.07.18 |
SQL Server : 개체 이름의 최대 문자 길이 (0) | 2020.07.18 |
java.util.zip.ZipException : packageAllDebugClassesForMultiDex 중 중복 항목 (0) | 2020.07.18 |
JavaScript에서 마우스 오른쪽 버튼 클릭 컨텍스트 메뉴를 비활성화하는 방법 (0) | 2020.07.18 |