我的项目中有两个模块:
两个模块都有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&gt; 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&gt; 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'
}
有人可以帮我这个吗?
答案 0 :(得分:7)
一切都很好,
基本上当我将app_list.gradle
更改为
apply plugin: 'com.android.application'
至apply plugin: 'com.android.library'
并从applicationId
删除了app_list.gradle
它编译并生成了apk但我收到了运行时错误,因为app和app_list都有相同的资源main_activity,所以R.java没有main_activity
res app_list
所以它给了illegal_parameter错误。当我将main_activity
的名称更改为某个唯一名称时,它解决了问题