首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法更新AndroidStudio3.1:在同步项目期间配置冲突:'armeabi-v7a,x86‘

无法更新AndroidStudio3.1:在同步项目期间配置冲突:'armeabi-v7a,x86‘
EN

Stack Overflow用户
提问于 2018-03-27 16:25:10
回答 5查看 25.5K关注 0票数 24

这是我的构建gradle (应用程序)文件:

代码语言:javascript
运行
复制
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'checkstyle'

def versions = ['appcompat_v7' : '25.1.0',
                'butterknife'  : '8.4.0',
                'leak_canary'  : '1.5',
                'card_view'    : '25.1.0',
                'design'       : '25.1.0',
                'photoview'    : '1.2.4',
                'play_services': '10.0.1']



task checkstyle(type: Checkstyle) {
    configFile file("${project.rootDir}/checkstyle/checkstyle.xml")
    configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
    // Where is my suppressions file for checkstyle is...
    source 'src'
    include '**/*.java'
    exclude '**/gen/**'
    classpath = files()
}


android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    flavorDimensions "versionCode"

    useLibrary 'org.apache.http.legacy'
    dexOptions {
        // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
        preDexLibraries = preDexEnabled && !travisBuild
    }

    defaultConfig {

        ndk {
            abiFilters 'x86', 'armeabi-v7a'
        }

        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.test.InstrumentationTestRunner"
    }
    signingConfigs {
        release
    }
    buildTypes {
        debug {
            debuggable true
        }
        release {
            //runProguard true
            proguardFile file('android.pro')
            proguardFile getDefaultProguardFile('proguard-android.txt')
            signingConfig signingConfigs.release
        }
    }

    splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a'
            universalApk true
        }
    }

    // map for the version code


    productFlavors {

        playstore {

        }
        develop {
        }
    }


    lintOptions {
        //I'm too lazy to translate everything
        abortOnError false
    }
    externalNativeBuild {
        ndkBuild {
            path 'src/main/jni/Android.mk'
        }
    }
}

def Properties props = new Properties()
def propFile = new File('signing.properties')
if (propFile.canRead()) {
    props.load(new FileInputStream(propFile))

    if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
            props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
        android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
        android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
        android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
        android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
    } else {
        println 'signing.properties found but some entries are missing'
        android.buildTypes.release.signingConfig = null
    }
} else {
    println 'signing.properties not found'
    android.buildTypes.release.signingConfig = null
}

buildscript {
    repositories {
        jcenter()
        mavenCentral()

    }
}


dependencies {
    compile project(":tess-two:tess-two")
    compile project(":volley")
    compile project(":real-time-ocr")

    compile 'com.github.barteksc:pdfium-android:1.5.0'
    compile fileTree(dir: 'src/main/libs', include: '*.jar')

    debugCompile "com.squareup.leakcanary:leakcanary-android:${versions.leak_canary}"
    releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:${versions.leak_canary}"
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    compile "com.commit451:PhotoView:${versions.photoview}"
    compile 'com.google.code.findbugs:jsr305:2.0.2'
    compile "com.google.guava:guava:18.0"
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile "com.android.support:design:${versions.design}"
    compile "com.android.support:appcompat-v7:${versions.appcompat_v7}"
    compile 'org.apache.commons:commons-compress:1.5'
    compile "com.android.support:cardview-v7:${versions.card_view}"
    compile 'com.google.code.gson:gson:2.8.2'
    compile "com.jakewharton:butterknife:${versions.butterknife}"
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    compile 'com.google.android.gms:play-services-vision:9.4.0+'
    compile group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.25.0'



    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
    androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
    androidTestCompile 'org.mockito:mockito-core:1.10.17'
    androidTestCompile 'junit:junit:4.12'


    testCompile 'junit:junit:4.12'
    testCompile "org.mockito:mockito-all:1.10.19"
    testCompile("org.robolectric:robolectric:3.0-rc2") {
        exclude group: 'commons-logging', module: 'commons-logging'
    }
    compile('com.crashlytics.sdk.android:crashlytics:2+') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:crashlytics-ndk:1+@aar') {
        transitive = true;
    }


    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.shawnlin:number-picker:2.4.4'
    compile 'com.squareup.picasso:picasso:2.5.2'



}
crashlytics {
    enableNdk true
    androidNdkOut '/Users/renard/devel/textfairy/tess-two/tess-two/obj'
    androidNdkLibsOut '/Users/renard/devel/textfairy/tess-two/tess-two/libs'
}
apply plugin: 'com.google.gms.google-services'

android无法同步项目并获得此错误:

冲突的配置:“armeabi-v7a,x86”在ndk abiFilters中设置为x86、armeabi-v7a时不能出现。 配置“编译”已经过时,并已被“实现”所取代。它将在2018年年底被移除。 配置“debugCompile”已经过时,并已被“调试器实现”所取代。它将在2018年年底被移除。 配置'androidTestApi‘已经过时,已经被'androidTestImplementation’取代。它将在2018年年底被移除。 配置'releaseCompile‘已经过时,已经被'releaseImplementation’取代。它将在2018年年底被移除。 配置'testCompile‘已经过时,已经被'testImplementation’取代。它将在2018年年底被移除。 配置'testApi‘已经过时,已经被'testImplementation’取代。它将在2018年年底被移除。 配置'androidTestCompile‘已经过时,已经被'androidTestImplementation’取代。它将在2018年年底被移除。 选项'android.enableAapt2‘被废弃,不应该再使用了。使用“android.enableAapt2=true”删除此警告。它将在2018年年底被移除。 配置“编译”已经过时,并已被“实现”所取代。它将在2018年年底被移除。 选项'android.enableAapt2‘被废弃,不应该再使用了。使用“android.enableAapt2=true”删除此警告。它将在2018年年底被移除。 配置'testCompile‘已经过时,已经被'testImplementation’取代。它将在2018年年底被移除。 配置'testApi‘已经过时,已经被'testImplementation’取代。它将在2018年年底被移除。 选项'android.enableAapt2‘被废弃,不应该再使用了。使用“android.enableAapt2=true”删除此警告。它将在2018年年底被移除。 配置“编译”已经过时,并已被“实现”所取代。它将在2018年年底被移除。

如果我删除这一行

代码语言:javascript
运行
复制
defaultConfig {

    ndk {
        abiFilters 'x86', 'armeabi-v7a'
    }

项目同步成功,但在构建时请给我此错误。

执行aapt失败

我已经试着清理和重建项目,但仍然没有工作!我还发布了build.gradle (项目)文件

代码语言:javascript
运行
复制
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
        jcenter()
        google()
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1+'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.android.tools.build:gradle:3.1.0'
    }
}



allprojects {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
        maven {
            url "http://oss.sonatype.org/content/repositories/snapshots"
        }
        maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }

}

ext {
    travisBuild = System.getenv("TRAVIS") == "true"
    // allows for -Dpre-dex=false to be set
    preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
}

我的gradle-wrapper.properties文件

代码语言:javascript
运行
复制
    #Tue Mar 27 14:42:14 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

还有我的gradle.properties文件

代码语言:javascript
运行
复制
    ndkDir=/Users/giuliopettenuzzo/Library/Android/sdk/ndk-bundle
org.gradle.jvmargs=-XX\:MaxPermSize\=512m
android.enableAapt2=false
EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2018-04-12 17:18:10

ndk.abiFilters配置意味着在最终的APK中将只包含本地库的选定处理器架构。

另一方面,splits.abi.enable true告诉编译器为选定的体系结构生成分离的APK。

这两种配置不能结合在一起。所以你有两个选择:

  1. 禁用分割APK (您已经知道了)。比你有一个APK要好。
  2. 删除ndk.abiFilters设置。会有多个(可能要小得多)的APK。此外,使用universalApk true,将生成具有所有体系结构的通用APK (可能比选项1中的要大得多)。

compile替换为新关键字implementation。我认为,从错误信息中可以清楚地看出这一点。

票数 31
EN

Stack Overflow用户

发布于 2018-03-27 18:13:07

我终于让它工作了

代码语言:javascript
运行
复制
abi {
    enable false
    reset()
    include 'x86', 'armeabi-v7a'
    universalApk true
}

multiDexEnabled true,但我不知道这是否解决了问题,还是忽略了错误。

票数 7
EN

Stack Overflow用户

发布于 2019-12-02 14:26:07

我不得不在这里添加"x86"

代码语言:javascript
运行
复制
ndk {
    abiFilters "armeabi-v7a", "arm64-v8a", "x86"
}

在defaultConfig里面。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49518003

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档