包括APK模块在Android Studio中的依赖 [英] Include apk module as dependency in android studio
问题描述
我有两个模块在我的项目:
I have two modules in my project:
- 应用
- app_list
这两个模块的Java和资源。 app_list
有一些活动,我想在应用
启动。
Both modules have java and res. app_list
has some activities that I want to launch in app
.
在Eclipse中,我曾作为app_list库的依赖,我是能够推出 app_list
的活动。在Android Studio中,当我加入 app_list
的依赖,它说:
In Eclipse, I had app_list as dependency library and I was able to launch activity of app_list
. In Android Studio, when I added app_list
as dependency, it says:
"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
"
应用程序>的build.gradle是如下:
app > build.gradle is as below:
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是如下:
app_list > build.gradle is as below:
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'
}
有人能帮助我?
推荐答案
一切都很好,
基本上,当我改变了 app_list.gradle
为
应用插件:'com.android.application
到应用插件:'com.android.library
并删除的applicationID
从 app_list.gradle
它编译生成APK,但我得到,这是因为这两个应用程序,并app_list两个有相同的资源main_activity所以R.java没有<$ C的 main_activity
水库运行时错误$ C> app_list 所以这是给illegal_parameter错误。当我改变了 main_activity
的名称,一些独特的命名它解决了问题。
apply plugin: 'com.android.application'
to apply plugin: 'com.android.library'
and deleted applicationId
from app_list.gradle
it compiled and generated apk but I was getting runtime error that was because both app and app_list both had same resource main_activity so R.java didn't have main_activity
res of app_list
so it was giving illegal_parameter error . When I changed name of main_activity
to some unique name it solved the issue
这篇关于包括APK模块在Android Studio中的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!