1

我按照新的 Android Studio 建议从以下位置升级 Gradle 和 Android 构建工具:

classpath 'com.android.tools.build:gradle:2.2.3'
buildToolsVersion '24.0.3'

至:

classpath 'com.android.tools.build:gradle:2.3.0'
buildToolsVersion '25.0.2'

但是在构建项目时出现错误:

Error:Could not find the AndroidManifest.xml file, using  generation folder [/Users/me/StudioProjects/myproject/mymodule/build/generated/source/apt/release])
Error:Execution failed for task ':mymodule:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

我尝试将所有 Android 支持库升级到最新版本,我什至尝试删除android-apt和使用,annotationProcessor而不是apt按照这个答案的建议,但它没有任何改变。


apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'

buildscript {
    repositories {
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.3.1'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

ext {
    androidAnnotationsVersion = '4.1.0'
    supportLibraryVersion = '25.1.1'
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    apt "org.androidannotations:androidannotations:$androidAnnotationsVersion"
    compile "org.androidannotations:androidannotations-api:$androidAnnotationsVersion"

    compile "com.android.support:support-v4:$supportLibraryVersion"
    compile("com.android.support:recyclerview-v7:$supportLibraryVersion") {
        exclude module: 'support-v4'
    }
    compile "com.android.support:appcompat-v7:$supportLibraryVersion"
    compile "com.android.support:cardview-v7:$supportLibraryVersion"
    compile("com.android.support:design:$supportLibraryVersion") {
        exclude module: 'support-v4'
        exclude module: 'appcompat-v7'
    }

    testCompile 'junit:junit:4.12'
}
4

0 回答 0