2021-01-23

Android Stuido 编译时遇到的问题

 

这个错误信息的原因是从NDK r17版本开始,已经不支持"armeabi、mips、mips64"这三种ABI格式了,而当前机器上安装的NDK版本是NDK r17之后的版本。

不过这个提示很能迷惑人,会让人误以为自己的build.gradle中配置了MIPSABI。实际上根本没有配置,是低版本的构建工具自己在默认构建MIPS格式,而又找不到对应的工具链。

解决方法很简单,要么使用低于NDK r17NDK版本,要么修改主工程的build.gradle,找到如下

 

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

 

 

将上面的   classpath 'com.android.tools.build:gradle:3.0.1'   改为     classpath 'com.android.tools.build:gradle:3.2.1'   重新执行  Buid/Rebuild  Project   又出现了如下的问题

File ->Settings

如上所示 将  Use local gradle distribution  下的  Gradle home: 选中本地已经下载解压完的 gradble-4.6 文件目录,再次编译后,会出现如下的问题

 

 

处理方法:

把AndroidManifest.xml 里的sdk最小版本设置都删掉 Androidstudio3.0 以后 不能在manifest.xml 设置这些 必须在 gradle里设置, 如下图所示 将

android:minSdkVersion="18"  一行删除, 再次重新编译.

 

此时出现如下的错误信息:

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

 

参照上面的提示, 修改app/build.gradle 文件, 此文件内容如下, 将文件中的26  改为  27  ,如下所示的红色加粗字体.

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.zmg.zmg_jdqc"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

再次编译   这次编译成功了.

 


 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值