Android Studio FAQ

1.Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)

Solution: add in build

 
 
implementation "com.google.guava:guava:23.0-android"

2.  com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex 
Solution: The reason is that the number of methods exceeds the limit. Add in the app's build.gradle file:
defaultConfig{
    multiDexEnabled true
}

3. Could not find method google() for arguments [] on repository container. gradle can be solved by upgrading to the latest version.

4.app:externalNativeBuildCleanDebug is deleted because the version does not support cmake



5.eclipse 转 android studio Could not resolve all files for configuration ':classpath'.

add in build.gradle

google() such as:

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

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

6.Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

The download process is interrupted and the gradle error occurs. You need to delete the corresponding directory and download it again.


7. Android Studio Error—Gradle: Error: Unmappable character encoding GBK

Solution:

Add the following code under build.gradle under the project to solve

tasks.withType(Compile) {  
    options.encoding = "UTF-8"  
}  

8.Android dependency has different version for the compile and runtime

Because the same build depends on two different versions of jar packages, check the difference between the version and api and implementation of each dependency.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325539294&siteId=291194637