Android应用程序使用使用“com.google.gson.Gson”的库(aar模块)。图书馆在其的build.gradle如下:为什么Android应用程序项目必须包含库使用的软件包
compile 'com.google.code.gson:gson:2.6.2'
的应用程序建立很好,但是当它开始产生以下错误:
Failed resolution of: Lcom/google/gson/Gson;
只有这样,才能解决它添加相同的编译线到应用程序的build.gradle:
compile 'com.google.code.gson:gson:2.6.2'
任何人都可以对此有所了解?
[编辑]
的文库与the standard procedure即所谓的“androidLibrary释放”应用程序下创建的文件夹中。以下行已添加到应用程序的build.gradle:
compile project(':androidLibrary-release')
你可以指定库吗? – mayosk
“Android应用程序使用库” - 如何?该库是否发布为Maven风格的回购,并且该应用是从那里引用它的?该库是否正在被'compile project(':modulename')'使用?你在做别的事吗? – CommonsWare
是的,库被编译项目(':modulename')使用。 @mayosk我将通过添加库的使用方式来编辑帖子。 – Hong