赞
踩
目录
1、LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
4、studio项目关联SVN后,如何断开连接并重新share subversion
5、okhttp的接收结果中报java.lang.IllegalStateException: closed异常
7、Can't create handler inside thread that has not called Looper.prepare()
8、Android Studio 执行 lint task的时候 可能会遇到如下错误。
9、INSTALL_FAILED_NO_MATCHING_ABIS 安装包安装失败
10、Error: Default interface methods are only supported starting with Android N (-- min-api 24)
11、Unity工程导出Android apk失败,错误信息如下:
12、Could not find com.android.tools.build:aapt2:3.3.2-5309881.
14、studio配置了忽略提交文件*.iml ,但是提交的时候.iml结尾的文件仍然在svn显示的问题
15、ERROR: The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin
16、Unknown failure: Failure - not installed for 0 Error while Installing APKs
17、com.android.tools.r8.CompilationFailedException: Compilation failed to complete
19、打签名apk包报错:Could not find org.codehaus.groovy:groovy-all:2.4.15.
21、INSTALL_FAILED_INSUFFICIENT_STORAGE
22、Could not resolve all files for configuration ':app:debugRuntimeClasspath',并提示某个libs下的包找不到
23、java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
25、使用命令行安装下载AndroidSDK,操作SDKManager下载文件时提示:
26、Android Studio在build.gradle中动态修改项目下的gradle.properties文件内容
28、Android studio编译工程提示:> java.net.MalformedURLException: no protocol:
29、error: resource android:attr/offset not found. error: failed linking references.
32、Unity游戏启动时自动获取了android_id等设备信息
33、在app运行过程中,前往设置界面将app已经拥有的动态权限手动关闭,再返回到app时,会出现重启现象,如果app没有做现场数据保护,即有可能出现空指针、数组越界等异常。
35、gradle编译apk包,assets下的文件有遗漏没有打包进apk包内。
36、You need to use a Theme.AppCompat theme (or descendant) with this activity
38、studio打包提示Failed to transform artifact ‘xxx.jar’ to match attributes
39、横屏游戏跳转三方竖屏应用,返回后闪退,在小米12机型,Android13系统,偶现,几率60%以上
41、AAPT: error: unexpected element found in .
遇到该异常是在listview中适配器中的getView方法里,导入布局后,设置布局中的控件layoutParams时报此异常,因item的父控件是listview,所以使用LayoutParams需要找其对应的类型,需要将LinearLayout LayoutParams修改成AbsListview LayoutParams即可;
在使用viewholder的适配器当中,使用if语句设置资源时,必须使用else,如果不设置在滑动的时候当convertView不为null时只走了if当中的一种情况,再滑动回原来的状态时,convertView使用的缓存视图当中的值,因为滑动前后走if情况不一,所以照成复用的时候会有数据错乱以及当前指针跟position不一致的情况,正确做法是使用if的时候必须使用else;在给控件设置点击事件的时候,在if情况中设置监听的时候,在else当中也必须要设置监听,else当中监听器设置nul即可;
这个是Android studio中导入eclipse的第三方依赖包出现的错误,提示是在清单文件里的错误,把manifest中的application标签内容全部删除后再次刷新后错误消失,具体原因待查。
另外贴上其他网友的解决办法 http://blog.csdn.net/qq_33785670/article/details/52455241
在项目的project模式下,打开.idea目录下的vcs.xml文件,将<mapping directory="" vcs="svn" />修改为<mapping directory="" vcs="" />;也就是把SVN删除;
然后打开项目所在磁盘,打开项目文件夹后把.svn文件夹删除,注意.SVN是隐藏文件,需要设置可查看隐藏文件;
再回到as中查看,这时就可以重新关联SVN了;
这是因为OkHttp请求回调中response.body().string()只能有效调用一次,在调用了response.body().string()方法之后,response中的流会被关闭,因此不能二次调用;
Android aidl导出jar包时需要注意,直接导出src会出现类找不到的情况。解决方法:导出时把gen文件夹下aidl生成的 Java文件选上即可。
Toast 的显示需要出现在一个线程的消息队列中;因为Toast在创建的时候会依赖于一个Handler,一个Handler是需要有一个Looper才能够创建,而普通的线程是不会自动去创建一个Looper对象,而在主线程中会默认创建一个Looper对象,因此不能在子线程中直接显示Toast;
有两种方法解决:
1、在开启的子线程中执行Looper.prepare()来构建一个Looper,然后在显示Toast,但是不要忘记执行Looper.loop()来加载这个Looper,
2、直接使用主线程的Looper对象;获取主线程的Looper的方法是Looper.getMainLooper()
Execution failed for task ':app:lint'.> Lint found errors in the project; aborting build.
只要在当前app的app/build.gradle文件内增加如下代码,
- android {
-
- lintOptions {
-
- abortOnError false
-
- }
- }
由于本机设备是x86架构,而所运行的项目为arm架构,只需要在项目的build.gradle中的android中加入以下代码:
- splits {
- abi {
- enable true
- reset()
- include 'x86', 'armeabi-v7a'
- universalApk true
- }
- }
原因分析: java8才支持静态接口方法,Android N 要求jdk版本为1.8
解决方案:定义和调用静态接口方法的module编译时都使用jdk1.8即可;
错误1:
- CommandWithNoStdoutInvokationFailure: Gradle initialization failed.
- UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) (at <f3fabed17af2442481d0f39cf9216fcb>:0)
- UnityEditor.Android.AndroidJavaTools.RunJavaWithShellExecute (System.String args, System.String workingdir, System.String error) (at <f3fabed17af2442481d0f39cf9216fcb>:0)
- UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <f3fabed17af2442481d0f39cf9216fcb>:0)
- Rethrow as GradleInvokationException: Gradle initialization failed.
- UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <f3fabed17af2442481d0f39cf9216fcb>:0)
- UnityEditor.Android.PostProcessAndroidPlayer+<ExecuteWarmup>c__AnonStorey0.<>m__0 () (at <f3fabed17af2442481d0f39cf9216fcb>:0)
- System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
- System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
- System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
- System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
- System.Threading.ThreadHelper.ThreadStart () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
- UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)
解决方案:在Build settings界面,安卓导包选项中,生成系统选择Internal(deprecated)一项,其他不变;如下图:
错误信息:
- Could not find com.android.tools.build:aapt2:3.3.2-5309881.
- Searched in the following locations:
- - file:/Users/heshuiguang/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
- - file:/Users/heshuiguang/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-osx.jar
- - file:/Users/heshuiguang/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
- - file:/Users/heshuiguang/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-osx.jar
- - file:/Users/heshuiguang/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
- - file:/Users/heshuiguang/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-osx.jar
解决方案:在项目的gradle下的allprojects中添加 google() 库
- allprojects {
- repositories {
- //添加谷歌库
- google();
- flatDir {
- dirs 'libs'
- }
- }
- }
解决方案:在AndroidStudio的terminal中输入 gradle compileDebugSource --stacktrace -info 命令,重新编译查看gradle的具体报错信息,如果报错中类似 processDebugManifest 信息的,同样把可以使用 gradle processDebugManifest 跟进出错的位置,以此类推,直到找到最终的错误位置;
打开Preferences,在如下图中红色线圈住的位置添加*.iml,即可解决
分析: module中build.gradle下的instrumentTest.setRoot(‘tests’) ,instrumentTest已经在旧版本中被弃用导致;
解决:使用 androidTest 替换 instrumentTest 即可;
解决:删除studio项目app下的build文件,然后重新编译;
(注:网上有的方案是在手机设置——>开发者选项——>关闭MIUI优化,有的是开启未知来源软件安装,但这两个方法对我的问题不管用,最后删除build文件夹好使了)
分析:引用的包冲突、引用的依赖库manifest.xml文件中package名称重复、或者build.gradle 中少jdk1.8的引用;
解决:1、冲突的包删除;
2、修改依赖库包名package;
3、在build.gradle中,android括号下添加:
- android {
-
- compileSdkVersion 28
-
- //添加1.8jdk引用
- compileOptions {
- sourceCompatibility = '1.8'
- targetCompatibility = '1.8'
- }
- }
解决:打开项目的build.gradle,添加google库和jcenter库,如下:
- buildscript {
- repositories {
- //添加google库和jcenter库,顺序必须google库在前
- google()
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.4.0'
- }
- }
-
- allprojects {
- repositories {
- //添加google库和jcenter库,顺序必须google库在前
- google()
- jcenter()
- flatDir {
- dirs 'libs'
- }
- }
- }
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
解决:方法同18,在项目的build.gradle中添加google库和jcenter库,顺序必须google库在前
- allprojects {
- repositories {
- //添加google库和jcenter库,顺序必须google库在前
- google()
- jcenter()
- flatDir {
- dirs 'libs'
- }
- }
- }
unity导出xcode工程报libiPhone-lib.a错误
解决:在build setting中找到 other link flags 添加三项:-Wl -undefined dynamic_lookup
studio编译安装apk时提示此问题,是由于手机的存储空间不足,删除一些APP即可;
出现该问题的背景,一个工程依赖一个library,这个library接入了第三方的SDK;
解决:将整个工程进行编译时,需要在app的build.gradle中的repositories中加入library的libs路径,如下方式:
问题:在使用DialogFragment过程中出现,
解决:摒弃commit方法提交Dialog,改为commitAllowingStateLoss,同时dismiss的时候改为dismissAllowingStateLoss
解决:需要在项目的build.gradle中指定jdk版本
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- Error: Could not determine SDK root.
- Error: Either specify it explicitly with --sdk_root= or move this package into its expected location: <sdk>/cmdline-tools/latest/
解决:命令中提示已经很清楚了,需要将下载的cmdline-tools下的所有文件放到latest的文件夹下,所以正确的文件路径应该是 【你的自定义目录/cmdline-tools/latest/bin】,cmdline-tools文件夹可以放到任意目录下,但cmdline-tools/latest/bin这个路径必须是死的。
如下图:
- //示例,修改gradle.properties下的AAPT2值为true资源
- project.afterEvaluate {
- File propFile = file("WorkSpace/gradle.properties")
- if (propFile.exists()) {
- def Properties props = new Properties()
- props.load(new FileInputStream(propFile))
- //修改gradle.properties文件下android.enableAapt2的值为true
- props['android.enableAapt2'] = "true"
- propFile.setWritable(true)
- props.store(new FileOutputStream(propFile), "")
- //获取值
- println "修改enableAapt2值成功:android.enableAapt2="+props['android.enableAapt2']
- } else {
- println "修改enableAapt2值失败,找不到gradle.properties文件"
- }
- }
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
- 2022-06-16 17:51:57.475 10897-11009/? A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 11009 (ProcessingThrea), pid 10897 (com.demo.test)
- 2022-06-16 17:51:57.545 11082-11082/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: Build fingerprint: 'Xiaomi/umi/umi:10/QKQ1.191117.002/V11.0.25.0.QJBCNXM:user/release-keys'
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: Revision: '0'
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: ABI: 'arm'
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: Timestamp: 2022-06-16 17:51:57+0800
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: pid: 10897, tid: 11009, name: ProcessingThrea >>> com.demo.test <<<
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: uid: 10392
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: Abort message: 'ubsan: implicit-conversion'
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: r0 00000000 r1 00002b01 r2 00000006 r3 c7700f48
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: r4 c7700f5c r5 c7700f40 r6 00002a91 r7 0000016b
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: r8 c7700f58 r9 c7700f48 r10 c7700f78 r11 c7700f68
- 2022-06-16 17:51:57.546 11082-11082/? A/DEBUG: ip 00002b01 sp c7700f18 lr f2b284cb pc f2b284de
- 2022-06-16 17:51:57.992 11082-11082/? A/DEBUG: backtrace:
- 2022-06-16 17:51:57.992 11082-11082/? A/DEBUG: #00 pc 000614de /apex/com.android.runtime/lib/bionic/libc.so (abort+166) (BuildId: 4f277b45cdd6aba6dbf234937ed923c5)
- 2022-06-16 17:51:57.992 11082-11082/? A/DEBUG: #01 pc 00011c1c /system/lib/libutils.so (abort_with_message(char const*)+24) (BuildId: 86b210dec3d83bb89e9ce269b1792ef8)
- 2022-06-16 17:51:57.992 11082-11082/? A/DEBUG: #02 pc 00011d14 /system/lib/libutils.so (__ubsan_handle_implicit_conversion_minimal_abort+24) (BuildId: 86b210dec3d83bb89e9ce269b1792ef8)
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
解决:调试手机设备CPU架构为arm64-v8a,但是编译环境设置的兼容架构不包含该架构模式,需要在module下的build.gradle中添加该架构。如下:
- ndk {
- abiFilters 'armeabi-v7a', 'x86','arm64-v8a'
- }
解决:检查工程路径是否包含空格,中划线【-】等不规范目录名
解决:如果资源存在的情况下,需要检查compileSdkVersion和buildToolsVersion版本是否一致。
解决:由于审核问题,具体参考:git 本地无法访问github解决方案 - ITFengHua - 博客园
解决:在AndroidManifest.xml文件的Application节点下添加如下代码:
- <application
-
- <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true"/>
-
- ......
- </application>
解决:
如果不移除Analytics包,则在启动的时候加入以下代码也可以
- void Awake()
- {
- UnityEngine.Analytics.Analytics.enabled = false;
- UnityEngine.Analytics.Analytics.deviceStatsEnabled = false;
- UnityEngine.Analytics.Analytics.initializeOnStartup = false;
- UnityEngine.Analytics.Analytics.limitUserTracking = false;
- UnityEngine.Analytics.PerformanceReporting.enabled = false;
- }
解决:
1、Android系统针对在app运行过程中,出现权限状态改变的情况,会杀死进程重启,针对这一背景,需要在onCreate方法中,判断现场保护数据是否为null,如果不为null,说明是非正常情况退出app,即需要在这里进行重启app操作。代码如下:
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- if (savedInstanceState != null){
- Log.e("TAG", "现场保护数据不为空,需要重新启动打开app");
- Intent intent=new Intent(this, MainActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
- startActivity(intent);
- return;
- }
- }
- FAILURE: Build failed with an exception.
-
- * What went wrong:
- Execution failed for task ':launcher:processDebugResources'.
- > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
- > AAPT2 aapt2-4.1.2-6503028-osx Daemon #1: Unexpected error during link, attempting to stop daemon.
- This should not happen under normal circumstances, please file an issue if it does.
-
- * Try:
- Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
-
- * Get more help at https://help.gradle.org
-
- BUILD FAILED in 58s
- 57 actionable tasks: 9 executed, 48 up-to-date
使用Unity版本2019版,compileSdkVersion为29;
解决:
- //将aaptOptions中的noCompress注释掉,也就是不压缩游戏资源
- //或者讲assets下的资源文件填写到noCompress后面,忽略压缩,切记assets下的文件数不要查过250个,
- //否则忽略压缩将失效。
- aaptOptions {
- //noCompress
- }
解决:Android gradle资源编译使用AAPT2,在打包assets资源时,在不配置aaptOptions时,使用默认的打包规则,即assets下以下划线“_”开头的目录或文件将会忽略,不会打包到apk内,针对此情况有两种解决方案:
一:修改assets下的文件目录或文件名称。
二:配置aaptOptions的ignoreAssetsPattern规则,如:
- android {
- aaptOptions {
- noCompress ''
- ignoreAssetsPattern "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
- }
- }
解决:根据报错提示的意思是,针对继承了AppCompatActivity的界面,其Manifest.xml的Activity样式也应该是AppCompat,在设置了android:theme="@style/Theme.AppCompat.Light.NoActionBar",仍然启动报错,最后排查到,引用的三方库中有重写了同样的AppCompat样式,并且Theme.AppCompat.Light没有继承父类样式Base.Theme.AppCompat.Light,导致Manifes.xml中引用的其实是下图自定义的样式,而不是AppCompat样式,重写的样式具体如下:
- <style name="Theme"/>
- <style name="Theme.AppCompat"/>
- <style name="Theme.AppCompat.Light"/>
- <style name="Theme.AppCompat.Light.NoActionBar">
- <item name="android:windowActionBar">false</item>
- <item name="android:windowNoTitle">true</item>
- </style>
其中Theme.AppCompat.Light必须有父类,这里重复了,且没有父类,把重复的删除掉即可。
解决:在unityPlayerActivity的onStart方法里,添加代码:
onWindowFocusChanged(true);
unity版本:2019.4.40f1
解决:需要再gradle.properties文件中配置:
- android.useAndroidX=false
- android.enableJetifier=false
- 2024-01-17 16:47:38.382 com.cyou.xxygb E Failed to find sync for id=26
- 2024-01-17 16:47:38.428 com.sohu.inputmethod.sogou.xiaomi E onConfigurationChanged
- 2024-01-17 16:47:38.439 com.sohu.inputmethod.sogou.xiaomi E onInitializeInterface
- 2024-01-17 16:47:38.449 touch_report E thp_filter: clear_zone_range
- 2024-01-17 16:47:38.449 touch_report E thp_filter: add zone 0: type=1, (0, 0, 14399, 450), orientation is 1
- 2024-01-17 16:47:38.449 touch_report E thp_filter: add zone 1: type=1, (0, 31540, 14399, 31999), orientation is 1
- 2024-01-17 16:47:38.449 touch_report E thp_filter: add zone 2: type=1, (0, 0, 450, 31999), orientation is 2
- 2024-01-17 16:47:38.449 touch_report E thp_filter: add zone 3: type=1, (13940, 0, 14399, 31999), orientation is 2
- 2024-01-17 16:47:38.449 touch_report E thp_filter: add zone 0: type=1, (13940, 0, 14399, 31999), orientation is 2
- 2024-01-17 16:47:38.449 touch_report E thp_filter: add zone 1: type=1, (13940, 0, 14399, 31999), orientation is 2
- 2024-01-17 16:47:38.449 touch_report E thp_filter: zone type=0, zone = (0, 0, 2800, 2800)
- 2024-01-17 16:47:38.449 touch_report E thp_filter: zone type=0, zone = (0, 29190, 2800, 31999)
- 2024-01-17 16:47:38.450 touch_report E thp_filter: zone type=1, zone = (0, 0, 14399, 450)
- 2024-01-17 16:47:38.450 touch_report E thp_filter: zone type=1, zone = (0, 31540, 14399, 31999)
- 2024-01-17 16:47:38.450 touch_report E thp_filter: zone type=1, zone = (0, 0, 450, 31999)
- 2024-01-17 16:47:38.450 touch_report E thp_filter: zone type=1, zone = (13940, 0, 14399, 31999)
- 2024-01-17 16:47:38.450 surfaceflinger E [setFrameBufferSizeForScaling]: newWidth: 2400 newHeight: 1080
- 2024-01-17 16:47:38.450 surfaceflinger E [setFrameBufferSizeForScaling]: displayWidth: 1080 displayHeight: 2400
- 2024-01-17 16:47:38.452 com.miui.home E rotateGesture---requestApplyInsets
- 2024-01-17 16:47:38.453 com.miui.home E rotateGesture---requestApplyInsets
- 2024-01-17 16:47:38.468 com.sohu.inputmethod.sogou.xiaomi E onStartInput
- 2024-01-17 16:47:38.476 com.sohu.inputmethod.sogou.xiaomi E onComputeInsets
- 2024-01-17 16:47:38.507 com.cyou.xxygb E OOM allocating Bitmap with dimensions 2400 x 16777215
- --------- beginning of crash
- 2024-01-17 16:47:38.508 com.cyou.xxygb E FATAL EXCEPTION: main
- Process: com.cyou.xxygb, PID: 30318
- java.lang.OutOfMemoryError
- at android.graphics.Bitmap.nativeCreate(Native Method)
- at android.graphics.Bitmap.createBitmap(Bitmap.java:1137)
- at android.graphics.Bitmap.createBitmap(Bitmap.java:1095)
- at android.graphics.Bitmap.createBitmap(Bitmap.java:1045)
- at android.graphics.Bitmap.createBitmap(Bitmap.java:1006)
- at com.unity3d.player.l$a.a(Unknown Source:10)
- at com.unity3d.player.l.a(Unknown Source:23)
- at com.unity3d.player.UnityPlayer$21.surfaceDestroyed(Unknown Source:20)
- at android.view.SurfaceView.notifySurfaceDestroyed(SurfaceView.java:1934)
- at android.view.SurfaceView.updateSurface(SurfaceView.java:1111)
- at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:345)
- at android.view.View.dispatchWindowVisibilityChanged(View.java:15445)
- at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1627)
- at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1627)
- at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1627)
- at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1627)
- at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2985)
- at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2476)
- at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9331)
- at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1390)
- at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1398)
- at android.view.Choreographer.doCallbacks(Choreographer.java:1040)
- at android.view.Choreographer.doFrame(Choreographer.java:954)
- at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1370)
- at android.os.Handler.handleCallback(Handler.java:942)
- at android.os.Handler.dispatchMessage(Handler.java:99)
- at android.os.Looper.loopOnce(Looper.java:210)
- at android.os.Looper.loop(Looper.java:299)
- at android.app.ActivityThread.main(ActivityThread.java:8123)
- at java.lang.reflect.Method.invoke(Native Method)
- at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
- 2024-01-17 16:47:38.511 surfaceflinger E surfaceflinger setAffinity failed, error=1
- 2024-01-17 16:47:38.511 surfaceflinger E surfaceflinger setAffinity failed.
- 2024-01-17 16:47:38.511 surfaceflinger E surfaceflinger setAffinity failed, error=1
- 2024-01-17 16:47:38.511 surfaceflinger E surfaceflinger setreAffinity failed.
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
原因:游戏使用的三方播放器导致在计算图片的时候错误,创建了尺寸为2400*16777215的对象,引发oom。
解决:max_allowed_packet
是 MySQL 中的一个设定参数,用于设定所接受的包的大小,查看当前机器mysql配置的大小,可以通过查看 /etc/my.cnf文件,其中max_allowed_packet = 1024M即为上述报错的上限值,调整该值即可,然后重启mysql。
解决:在Android项目级build.gradle中,修改Gradle插件版本为4.2.1及以上
- dependencies {
- classpath 'com.android.tools.build:gradle:4.2.1'
- }
其对应的Gradle版本必须为6.7.1及以上。
更新于2024.01.17
持续更新...
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。