【发布时间】:2015-08-03 12:21:00
【问题描述】:
我的项目中有两个模块:
- 应用程序
- app_list
两个模块都有 java 和 res。 app_list 有一些我想在app 发起的活动。
在 Eclipse 中,我将 app_list 作为依赖库,并且能够启动 app_list 的活动。在 Android Studio 中,当我添加 app_list 作为依赖项时,它说:
"Error:A problem occurred configuring project ':app'.
> Dependency NewMathBuzz:app_list:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: <home>/NewMathBuzz/app_list/build/outputs/apk/app_list-release-unsigned.apk
"
app > build.gradle 如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.mass.mathbuzz"
minSdkVersion 7
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':app_list')
compile fileTree(dir: 'libs', include: ['*.jar'])
}
app_list > build.gradle 如下:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.android.support:appcompat-v7:22.0.0'
}
有人可以帮我解决这个问题吗?
【问题讨论】:
-
apk 文件不能是依赖项。你做错了什么
-
@Vlad 那么我该怎么做呢,基本上 app_list 有我想包含在许多应用程序中的通用 Activity,所以我正在制作广告模块
-
显示你的 build.gradle
-
@VladMatvienko 我刚刚更新,你能看到吗
-
好的,尝试将
apply plugin: 'com.android.application'中的app_listbuild.gradle更改为apply plugin: 'com.android.library'
标签: android eclipse android-studio