Skip to content

编译别人ASProject的一些坑

Posted on:August 1, 2019 at 15:03:34 GMT+8

报错:

Failed to find Build Tools revision 26.0.1
Install Build Tools 26.0.1 and sync project

解决:


报错:

No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android

解决:

https://blog.csdn.net/vocanicy/article/details/83004626

build.gradle改为3.1以上(具体可以新建一个项目查看)

        classpath 'com.android.tools.build:gradle:3.2.1'

报错:

Could not find com.android.tools.build:gradle:3.2.1.
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
Required by:
    project :
Add Google Maven repository and sync project
Open File
Enable embedded Maven repository and sync project

解决:

按AS说的做

点击

Add Google Maven repository and sync project

Enable embedded Maven repository and sync project

其中之一


报错:

Could not find com.android.support:appcompat-v7:25.3.1.
Required by:
​    project :app

Please install the Android Support Repository from the Android SDK Manager.

解决:

按AS说的做

File | Settings | Appearance & Behavior | System Settings | Android SDK

SDK Tools 下载 Android Support Repository


报错:

Could not find com.android.support.constraint:constraint-layout:1.0.1.
Required by:
​    project :app
Search in build.gradle files

解决:

安装对应的版本(这里是1.0.1)


报错:

Cause: android-apt plugin is incompatible with the Android Gradle plugin.  Please use
'annotationProcessor' configuration instead.

原因:

https://blog.csdn.net/wusj3/article/details/74036463

Gradle插件2.2之前,APT(Annotation Processing Tool)框架一般使用第三方android-apt库。2.2内置annotationProcessor,android-apt作者同时宣布不再维护。annotationProcessor同时支持javac和jack编译方式,而android-apt只支持javac编译方式。

解决:

app/build.gradle

删掉

apply plugin: 'android-apt'

    apt 'com.jakewharton:butterknife-compiler:8.2.1'

替换成

	annotationProcessor 'com.jakewharton:butterknife-compiler:8.2.1'

报错:

Lint found fatal errors while assembling a release target.

To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
...

解决:

可能不是好的解决方法

按AS说的做

粘贴

lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
}

app/build.gradle


报错:

Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html


Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html


Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

解决:

按AS说的做

app/build.gradle中过时的替换掉