3

我已经在这几天试图在 Android Studio 中获得正确的库结构。我本来会继续使用 Eclipse,但在性能方面,最近对我来说真的很糟糕。请,任何指导将不胜感激,因为找到的所有解决方案都没有奏效,并且文档让我无处可去。

除主 TestProject 外,所有清单都有一个空的应用程序标记。

编辑* 在包括 SlidingMenu 之前,我确实让 ActionBarSherlock 工作没有问题和构建等。

错误

Gradle: Execution failed for task ':libraries:SlidingMenu:processReleaseManifest'.
> Manifest merging failed. See console for more info.

Build.Gradle (SlidingMenu)

apply plugin: 'android-library'

buildscript {
   repositories {
      mavenCentral()
}

  dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
  }
}

dependencies {
        compile 'com.android.support:support-v4:13.0.+'
        compile project(':libraries:actionbarsherlock')
    }

android {
    compileSdkVersion 17
    buildToolsVersion '17.0.0'


sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aild.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
        }
    }
}

Build.Gradle (ActionBarSherlock)

apply plugin: 'android-library'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}

dependencies {
    compile 'com.android.support:support-v4:13.0.+'
}

android {
    compileSdkVersion 17
    buildToolsVersion '17.0.0'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aild.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }
}

Build.Gradle(测试项目)

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:13.0.+'
    compile project(':libraries:actionbarsherlock')
    compile project(':libraries:SlidingMenu')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
}

settings.gradle(测试项目)

include ':TestProject',':libraries:actionbarsherlock',':libraries:SlidingMenu'
4

3 回答 3

5

<application/>对我来说,问题在于滑动菜单库中的“缺少标签”。将空<application/>标签添加到清单后,错误消失了。也许这会对某人有所帮助。

在此处查看线​​程:https ://groups.google.com/forum/#!topic/adt-dev/PIah7eYXiNs

于 2013-11-12T08:21:11.323 回答
4

不幸的是,发生这种情况的原因有很多。我建议gradle build -info从命令行运行以查看它是否为您提供更多信息。

我遇到的一个常见合并失败是 minSdkVersions 冲突时。我看到您的测试项目 minSdkVersion 是 7,ActionBarSherlock 和 SlidingMenu 清单中声明的​​最低级别是 7 还是更少?

于 2013-07-13T23:22:15.827 回答
4

我已经解决了。我分享我的配置。也许这可以帮助你。

项目:

+ TestProject
|-- libraries
   |-- ActionBarSherlock
       |-- actionbarsherlock
       |-- actionbarsherlock-fest
       |-- actionbarsherlock-i18n
       |-- actionbarsherlock-samples
   |-- SlidingMenu
       |-- art
       |-- example
       |-- library
       |-- library-maps-support
|-- TestProject

设置.gradle

include ':TestProject', ':libraries:SlidingMenu:library', ':libraries:ActionBarSherlock:actionbarsherlock'

build.gradle(测试项目)

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile project(':libraries:ActionBarSherlock:actionbarsherlock')
    compile project(':libraries:SlidingMenu:library')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 16
    }
}

build.gradle (actionbarsherlock 库)

buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android-library'

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 16
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('tests')
    }
}

build.gradle(滑动菜单库)

buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android-library'

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
    compile project(':libraries:ActionBarSherlock:actionbarsherlock')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 16
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('tests')
    }
}
于 2013-07-14T17:05:00.920 回答