Android的工作室建立在同一个项目的两个应用程序simultaenously [英] Android Studio builds two applications for the same project simultaenously

查看:200
本文介绍了Android的工作室建立在同一个项目的两个应用程序simultaenously的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Android工作室v0.5.9,其中有一个库项目作为依赖的应用程序。但是,我每次运行该项目具有相同的名称和图标2的APK时,被部署到我的设备。第一个APK(APP)包含我的主模块,而,第二个是库项目本身。然而,当我从Eclipse运行在同一个项目中,只有一个APK部署和它完美的作品。

I'm making an app using Android Studio v0.5.9, which has a library project as a dependency. But, every time I run the project two apks having the same name and icon, are deployed to my device. The first apk(app) contains my main module, whereas, the second one is the library project itself. However, when I run the same project from Eclipse, only one apk is deployed and it works perfectly.

下面是问题的一些截图 -

Here are some screenshots of the problem -

第一个应用程序(我的模块) -

First App(My module) -

第二个应用程序(库项目) -

Second App(library project) -

顶级的build.gradle 文件 -

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

主模块的build.gradle 文件 -

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'
    defaultConfig {
        packageName 'com.Swap.Rooms'
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.android.support:appcompat-v7:19.0.1'
    compile 'com.android.support:appcompat-v7:19.+'
    compile project(':lib')
}

库项目的build.gradle 文件 -

apply plugin: 'android-library'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        packageName "com.jfeinstein.jazzyviewpager"
        minSdkVersion 4
        targetSdkVersion 17
    }

    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:+'
    compile files('libs/nineoldandroids-2.4.0.jar')
}

settings.gradle -

include ':app'
include ':lib'

请帮我解决这个问题。在此先感谢!

Please help me to fix this. Thanks in advance!!

推荐答案

也许这将是对他人有帮助的。

Maybe this will be helpful for others.

摇篮正在做清单合并为库项目也是如此。所以,问题是保持 AndroidManifes.xml 从库不变。它有应用节点用于演示目的,这点已成功合并,主的Andr​​oidManifest.xml

Gradle is doing manifest merge for library projects as well. So issue was to keep AndroidManifes.xml unchanged from library. It had application node for demo purposes and this node was successfully merged to main AndroidManifest.xml.

我要提交问题,因为谷歌我觉得应该prevent或警告这样的情况。

I'm going to submit issue to Google since I think it should prevent or warn about such situation.

这篇关于Android的工作室建立在同一个项目的两个应用程序simultaenously的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆