编译Android Gallery图库源码所遇bug
来源:互联网 发布:path软件2017 编辑:程序博客网 时间:2024/06/05 02:51
转载请注明出处: http://blog.csdn.net/lb377463323/article/details/68936291
1. selectiveAdjust() isnot supported in SDK levels 11-15
Error:(99, 32) error: Non-root compute kernel selectiveAdjust() is not supported in SDK levels 11-15
F:\Apps\GalleryActivity\app\src\main\rs\grad.rs
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
在清单文件中设置minSdkVersion大于15即可
2. ScriptC_grad cannot be resolved to a type
Description Resource Path Location Type
ScriptC_grad cannot be resolved to a type ImageFilterGrad.java /GalleryActivity/src/com/android/gallery3d/filtershow/filters line 146 Java Problem
这是Eclipse的Android Dependencies找不到renderscript-v8.jar这个包,或者这个包的版本不对。
如果是找不到这个包的话,右键项目名 -> 点击Properties ->Java Build Path -> Libraries -> Add External JARs。
如果是包版本不对的话,打开project.properties文件,设置sdk.buildtools为正确版本即可,如sdk.buildtools=25.0.2。如果不在此处设置的话会默认使用sdk中Build-Tools的最高版本,你把版本过高的Build-Tools卸载掉也行。
3. AndroidStudio找不到RenderScript
在AndroidStudio中使用V8包中的RenderScript,只需要修改项目的build.gradle中的代码即可
android { ... defaultConfig { ... renderscriptTargetApi 18 renderscriptSupportModeEnabled true } ...}
4. Duplicate files copied in APK META-INF/DEPENDENCIES
Error:Execution failed for task ‘:app:transformResourcesWithMergeJavaResForDebug’.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/DEPENDENCIES
File1: F:\Apps\GalleryActivity\app\libs\httpclient-4.5.3.jar
File2: F:\Apps\GalleryActivity\app\libs\httpcore-4.4.6.jar
这是因为两个包里面有文件重复了, 打开项目下面的 build.gradle 文件,在 android 代码块中添加下面代码,排除掉重复文件
packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/MANIFEXT.MF'}
5. Your project contains C++ files but it is not using a supported native build system
Error:Execution failed for task ‘:app:compileDebugNdk’.
Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration with the stable Android Gradle plugin:
https://developer.android.com/studio/projects/add-native-code.html
or use the experimental plugin:
https://developer.android.com/studio/build/experimental-plugin.html.
首先在工程目录下的gradle.properties文件的末尾加上一句(如果没有gradle.properties文件 ,自己拷一份进来):
Android.useDeprecatedNdk=true
然后再在文件build.gradle(Module:app)里面的buildTypes类中添加一个这样的方法
sourceSets {
main {
jni.srcDirs = []
}
}
6. INSTALL_FAILED_CONFLICTING_PROVIDER
Installation failed with message Failed to finalize session : INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn’t be installed in /data/app/com.android.gallery3d-1: Can’t install because provider name com.android.gallery3d.provider (in package com.android.gallery3d) is already used by com.vivo.gallery.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
把清单文件里面的provider的android:authorities改成别的名字,我这里是在最后加1
<provider android:name="com.android.gallery3d.provider.GalleryProvider" android:syncable="false" android:grantUriPermissions="true" android:exported="true" android:permission="com.android.gallery3d.permission.GALLERY_PROVIDER1" android:authorities="com.android.gallery3d.provider1" />
如果出现INSTALL_FAILED_DUPLICATE_PERMISSION这个错误,就把清单文件的自定义permission的name改掉
<permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER1" android:protectionLevel="signatureOrSystem" /><uses-permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER1" />
还有一种情况:手机一卸载冲突的那个APP,但是还是提示此错误,这可能是卸载不干净。
在终端中使用adb卸载即可: adb uninstall 包名
7. http:// schemas.android.com/apk/res-auto
Error:(19) Error: In Gradle projects, always use http://schemas.android.com/apk/res-auto for custom attributes [ResAuto]
将eclipse中
http://schemas.android.com/apk/res/com.xxx.xxx
换成
http://schemas.android.com/apk/res-auto
8,Gradle DSL method not found: ‘android()’
Error:(16, 0) Gradle DSL method not found: ‘android()’
Possible causes:
- The project ‘GalleryActivity’ may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file - The build file may be missing a Gradle plugin.
Apply Gradle plugin
删除项目根目录build.gradle里面的android标签,如下图整个框内都删除,然后重新编译
9, NDK integration is deprecated in the current plugin
Error:(14, 0) Error: NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin. For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental. Set “android.useDeprecatedNdk=true” in gradle.properties to continue using the current NDK integration.
Open File
在gradle.properties文件中添加android.useDeprecatedNdk=true
注意大小写不可错
10,找不到符号
如果出现类似以下的错误:
Error:(95, 45) 错误: 找不到符号 符号: 变量 FORMAT_DNG 位置: 类 MtpConstants
检查build.tools版本,很大可能是因为build.tools版本太低了
11, java.lang.ClassNotFoundException,Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
如果遇到Android Studio直接run可以运行APP,但是Build APK生成的不能运行,出现上述报错信息,很大可能是因为Instant Run导致的,把它禁掉再重新生成apk就行了。
Android Studio –> File –> Setting –> Build, execution, deploy –> Instant Run.
- 编译Android Gallery图库源码所遇bug
- Android 7.0 Gallery图库源码分析1
- Android 7.0 Gallery图库源码分析2
- Android 7.0 Gallery图库源码分析3
- Android 7.0 Gallery图库源码分析4
- Android 7.0 Gallery图库源码分析5
- Android 7.0 Gallery图库源码分析6
- Android 7.0 Gallery图库源码分析7
- Android 7.0 Gallery图库源码分析8
- Android 7.0 Gallery图库源码分析1
- Android 7.0 Gallery图库源码分析9
- android从图库(gallery)选择一张图片
- android从图库(gallery)选择一张图片
- Matplotlib gallery 图库
- Android所遇bug及解决方法汇总
- 配置Android源码编译环境所需包
- 编译android源码所遇到的问题收集
- 编译busybox所遇到的bug
- Android启动App疑团
- JDK环境变量配置
- pat乙级1012
- boke
- webuploader实现批量图片上传功能
- 编译Android Gallery图库源码所遇bug
- 博客
- String Permutation java solution
- 你在哪里?
- LabVIEW查找范例的使用举例
- Could not get lock /var/lib/dpkg/lock
- jquery插件开发学习笔记(五)——动态选择触发器
- 在windows下安装nvm
- pat乙级1010