Android开发问题解决

错误一

错误描述:android.view.InflateException: Binary XML file line #33: Error inflating class fragment

错误原因:类库不支持

解决方法:

  • fragment导入android.support.v4.app.Fragment和android.support.v4.app.FragmentTransaction;
  • activity继承FragmentActivity

错误二

错误描述:Error:Execution failed for task ':schoolpa:transformResourcesWithMergeJavaResForDebug'.

> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.belerweb/pinyin4j/pom.properties

错误原因:jar包重复

解决方法:

  • 第一步:项目gradle-android节点下增加以下属性

  • packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.xml'
    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.properties'
    }
    dexOptions {
    javaMaxHeapSize "4g" //specify the heap size for the dex process
    preDexLibraries = false //delete the already predexed libraries
    }

  • 第二步:同步项目,clean项目,rebuild项目,运行项目即可

错误三

错误描述:No tab content FrameLayout found for id xxx

错误原因:未知

解决方法:

  • 删掉xml中的Tabwidget

错误四

错误描述:

DELETE_FAILED_INTERNAL_ERROR
Error while Installing APKs

错误原因:未知

解决方法:

  • clean项目,rebuild项目,运行项目即可

错误五

错误描述:

java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

错误原因:未知

解决方法(慎重使用):

defaultConfig {

minSdkVersion 14
targetSdkVersion 21

multiDexEnabled true
}

 dependencies {
 compile 'com.android.support:multidex:1.0.0'
 }

错误六

错误描述:

Error:Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (1.3.9) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

错误原因:未知

解决方法:

android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}

你可能感兴趣的:(Android开发问题解决)