我尝试使用APK Expansion libs zip_file和downloader_library(需要play_licensing). zip_file工作正常,因为它没有依赖项,但是当我尝试Gradle同步时,play_licensing会引发错误.
Information:Gradle tasks [:app:generateGoogleDebugSources,:app:libs:downloader_library:generateDebugSources,:app:libs:play_licensing:generateDebugSources,:app:libs:zip_file:generateDebugSources] Information:/Users/faiz/Projects/Android/TogetherTime/app/libs/play_licensing/aidl/ILicenseResultListener.aidl:21 interface ILicenseResultListener should be declared in a file called com/android/vending/licensing/ILicenseResultListener.aidl. Information:2 errors Information:0 warnings Information:See complete output in console /Users/faiz/Projects/Android/TogetherTime/app/libs/play_licensing/aidl/ILicensingService.aidl Error:(19) couldn't find import for class com.android.vending.licensing.ILicenseResultListener Error:(19) Execution Failed for task ':app:libs:play_licensing:compileReleaseAidl'. > com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/faiz/Projects/Android/android-sdk-macosx/build-tools/19.0.3/aidl -p/Users/faiz/Projects/Android/android-sdk-macosx/platforms/android-19/framework.aidl -o/Users/faiz/Projects/Android/TogetherTime/app/libs/play_licensing/build/source/aidl/release -I/Users/faiz/Projects/Android/TogetherTime/app/libs/play_licensing/aidl -I/Users/faiz/Projects/Android/TogetherTime/app/libs/play_licensing/src/release/aidl -d/var/folders/y6/g0d5m3f94rxdvq5myp53d9k80000gn/T/aidl662748145109587430.d /Users/faiz/Projects/Android/TogetherTime/app/libs/play_licensing/aidl/ILicensingService.aidl Error Code: 1 Output: /Users/faiz/Projects/Android/TogetherTime/app/libs/play_licensing/aidl/ILicensingService.aidl:19: couldn't find import for class com.android.vending.licensing.ILicenseResultListener
我没有修改任何库,但由于它们不是为Gradle构建的,我从另一个项目复制了build.gradle并相应地修改它们.
downloader_library /的build.gradle
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android-library' dependencies { compile 'com.android.support:support-v4:+' compile project(':app:libs:play_licensing') } android { compileSdkVersion 19 buildToolsVersion "19.0.3" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] res.srcDirs = ['res'] } } defaultConfig { minSdkVersion 4 targetSdkVersion 19 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.txt' } } }
play_licensing /的build.gradle
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android-library' dependencies { compile 'com.android.support:support-v4:+' } android { compileSdkVersion 19 buildToolsVersion "19.0.3" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] res.srcDirs = ['res'] aidl.srcDirs = ['aidl'] } } defaultConfig { minSdkVersion 3 targetSdkVersion 19 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.txt' } } }
我目前正在使用Android Studio 0.5.1和gradle 0.9.0以及构建工具19.0.3