android---实际开发中遇到的问题总结

在实际开发项目的时候经常会遇到一些问题,在这里进行总结,希望读者在遇到相同问题的时候能够尽快解决自己的问题,或者为读者提供一种解决方案


问题1:

        

随着项目的逐渐增大,不可避免的要设置mutidex 但是这会使我们的项目编译变慢,并且有的时候会发生很多异常,导致编译不成功
(1) 对于有很多依赖的项目,编译可能因为下面的错误中断
Error:Execution failed for task ':app:dexDebug'. ...
Error Code: 3 Output: UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:326)
具体解决方式:在app的build.gradle中设置下边两句可以解决
dexOptions { incremental true javaMaxHeapSize "4g" }

问题2:
INSTALL_FAILED_NO_MATCHING_
解决方式:是由于使用了native libraries 。该native libraries 不支持当前的cpu的体系结构。
INSTALL_FAILED_NO_MATCHING_ABIS is when you are trying to install an app that has native libraries and it doesn't have a native library for your cpu architecture. For example if you compiled an app for armv7 and are trying to install it on an emulator that uses the Intel architecture instead it will not work.现在安卓模拟器的CPU/ABI一般有三种类型,INTEL X86,ARM,MIPS,


猜你喜欢

转载自blog.csdn.net/ming655243/article/details/78731333