Error while trying to build library locally and binding to project: Error:Configuration with name 'default' not found

扶醉桌前 提交于 2020-01-06 16:18:37

问题


I have been trying to link the local copy of Android Beacon Library on my computer with my project on Android Studio and I have tried several methods described in this thread How do I add a library project to the Android Studio? No matter what method I use, I keep getting the error stated in the title. Some threads on Stack Overflow suggest that this is due to submodules within the library and that it could be fixed with "git submodule update --init" but that didn't do anything for me.

As I've said, I tried different methods for adding the library but just for reference, the latest method I did was to add the library to the app/libs/ folder and make the following changes in the code:

settings.gradle: include ':app',':libs:AndroidBeaconLibrary'

build.gradle: added compile project(":libs:AndroidBeaconLibrary") to dependancies.


回答1:


Ok so I've solved the problem. The issue was that it should have been ':app:libs:AndroidBeaconLibrary' instead of ':libs:AndroidBeaconLibrary' in both gradle files.

This fixed the error but a new one came up:

Error:Cannot cast object '23.0.0' with class 'com.android.repository.Revision' to class 'com.android.sdklib.repository.FullRevision'

I fixed this using this answer https://stackoverflow.com/a/33889117/3001845 I added the lines in the build.gradle file of the library itself under 'buildscript'

The section now looks like this:

buildscript {
 repositories {
     jcenter()
     maven { url 'https://jitpack.io' }
 }

 dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
    classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
 }
}


来源:https://stackoverflow.com/questions/37470613/error-while-trying-to-build-library-locally-and-binding-to-project-errorconfig

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!