在android studio中包含apk模块作为依赖项

Sha*_*adi 0 eclipse android android-studio

我的项目中有两个模块:

  1. 应用
  2. 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
"
Run Code Online (Sandbox Code Playgroud)

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'])
}
Run Code Online (Sandbox Code Playgroud)

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'
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮我吗?

Sha*_*adi 7

一切都很好,

基本上当我换app_list.gradle

apply plugin: 'com.android.application'apply plugin: 'com.android.library'并删除applicationIdapp_list.gradle 它编译生成APK,但我得到的,这是因为这两个应用程序,并app_list两个有相同的资源main_activity所以R.java没有运行时错误main_activity的RES app_list所以这是给illegal_parameter错误.当我将名称更改main_activity为某个唯一名称时,它解决了问题