项目中遇到的一些问题或异常以及处理方法

目录

1、LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams

2、getView方法中在给textview等其他控件设置资源时,使用到 if 语句或者 else if 时,上下滑动listview,当返回到第一屏时,部分复用的item指针position发生了变化;

3、Error:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed with multiple errors, see logs

4、studio项目关联SVN后,如何断开连接并重新share subversion

5、okhttp的接收结果中报java.lang.IllegalStateException: closed异常

6、android aidl导出jar包

7、Can't create handler inside thread that has not called Looper.prepare()

8、Android Studio 执行 lint task的时候 可能会遇到如下错误。Execution failed for task ':app:lint'.> Lint found errors in the project; aborting build.

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.

13、项目编译阶段出现错误:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileJava'

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

18、om.android.tools.lint:lint-gradle:26.4.0 > com.android.tools.build:builder:3.4.0 > com.android.tools.build:apkzlib:3.4.0

19、打签名apk包报错:Could not find org.codehaus.groovy:groovy-all:2.4.15.

20、libiPhone-lib.a错误 

21、使用adb命令安装报错: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

24、AGPBI: {"kind":"error","text":"Invoke-customs are only supported starting with Android O (--min-api 26)","sources":[{}],"tool":"D8"}

25、使用命令行安装下载AndroidSDK,操作SDKManager下载文件时提示:

26、Android Studio在build.gradle中动态修改项目下的gradle.properties文件内容

27、CPU架构不兼容

28、Android studio编译工程提示:> java.net.MalformedURLException: no protocol:

29、error: resource android:attr/offset not found.  error: failed linking references.

30、无法访问GitHub,从Git拉取代码失败问题

31、Untiy游戏启动自动申请Android存储权限

32、Unity游戏启动时自动获取了android_id等设备信息

33、在app运行过程中,前往设置界面将app已经拥有的动态权限手动关闭,再返回到app时,会出现重启现象,如果app没有做现场数据保护,即有可能出现空指针、数组越界等异常。

34、游戏编译时报错如下:

35、gradle编译apk包,assets下的文件有遗漏没有打包进apk包内。

36、You need to use a Theme.AppCompat theme (or descendant) with this activity

37、游戏切后台返回后出现黑屏

38、studio打包提示Failed to transform artifact ‘xxx.jar’ to match attributes

39、横屏游戏跳转三方竖屏应用,返回后闪退,在小米12机型,Android13系统,偶现,几率60%以上

40、mysql出现报错:Package for query is too large (xxxxxxxx > 4194304). You can change this value on the server by setting the max_allowed_package variable

41、AAPT: error: unexpected element found in .

42、SplitApkInstallerBase: Failed to commit install session 388416319 with command package install-commit 388416319. Error: INSTALL_FAILED_TEST_ONLY: installPackageLI

43、海外接入Firebase crashlyties启动报错:java.lang.RuntimeException: Unable to get provider

44、Untiy启动会自动读取应用安装列表:android.app.ApplicationPackageManager.queryIntentActivities(Native Method)

45、Android Studio打包报错:Direct local .aar file dependencies are not supported when building an AAR.

46、海外项目编译报错:Could not resolve all files for configuration ':Demo:releaseRuntimeClasspath'.

47、Facebook分享没有回调

48、“Journey Renewed: Fate Fantasy”的请求不符合 Google 的“使用安全浏览器”政策。如果此应用有对应的网站,您可打开网络浏览器并尝试从该网站中登录。如果您正尝试访问无线网络,请按照这些说明操作。

49、unity出mac版本的包报错:error CS0234: The type or namespace name 'PackageManager' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

50、有关Vuplex 3DWebView在Android 8、9系统上反编译重打包导致的闪退问题

51、海外项目对接AppsFlyer v6.16.0版本,在Android Gradle插件版本7.1.2,Gradle版本7.5,jdk版本17环境编译报错,报错日志如下:

One or more classes has class file version >= 56 which is not officially supported.com.android.tools.r8.internal.YI0: Sealed classes are not supported as program classesOne or more classes has class file version >= 56 which is not officially supported.

52、Google登录失败,返回code=10,message=10


1、LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams

遇到该异常是在listview中适配器中的getView方法里,导入布局后,设置布局中的控件layoutParams时报此异常,因item的父控件是listview,所以使用LayoutParams需要找其对应的类型,需要将LinearLayout LayoutParams修改成AbsListview LayoutParams即可;

2、getView方法中在给textview等其他控件设置资源时,使用到 if 语句或者 else if 时,上下滑动listview,当返回到第一屏时,部分复用的item指针position发生了变化;

在使用viewholder的适配器当中,使用if语句设置资源时,必须使用else,如果不设置在滑动的时候当convertView不为null时只走了if当中的一种情况,再滑动回原来的状态时,convertView使用的缓存视图当中的值,因为滑动前后走if情况不一,所以照成复用的时候会有数据错乱以及当前指针跟position不一致的情况,正确做法是使用if的时候必须使用else;在给控件设置点击事件的时候,在if情况中设置监听的时候,在else当中也必须要设置监听,else当中监听器设置nul即可;

3、Error:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed with multiple errors, see logs

这个是Android studio中导入eclipse的第三方依赖包出现的错误,提示是在清单文件里的错误,把manifest中的application标签内容全部删除后再次刷新后错误消失,具体原因待查。

另外贴上其他网友的解决办法  http://blog.youkuaiyun.com/qq_33785670/article/details/52455241

4、studio项目关联SVN后,如何断开连接并重新share subversion

在项目的project模式下,打开.idea目录下的vcs.xml文件,将<mapping directory="" vcs="svn" />修改为<mapping directory="" vcs="" />;也就是把SVN删除;

然后打开项目所在磁盘,打开项目文件夹后把.svn文件夹删除,注意.SVN是隐藏文件,需要设置可查看隐藏文件;

再回到as中查看,这时就可以重新关联SVN了;

5、okhttp的接收结果中报java.lang.IllegalStateException: closed异常

这是因为OkHttp请求回调中response.body().string()只能有效调用一次,在调用了response.body().string()方法之后,response中的流会被关闭,因此不能二次调用; 

6、android aidl导出jar包

Android aidl导出jar包时需要注意,直接导出src会出现类找不到的情况。解决方法:导出时把gen文件夹下aidl生成的 Java文件选上即可。

7、Can't create handler inside thread that has not called Looper.prepare()

Toast 的显示需要出现在一个线程的消息队列中;因为Toast在创建的时候会依赖于一个Handler,一个Handler是需要有一个Looper才能够创建,而普通的线程是不会自动去创建一个Looper对象,而在主线程中会默认创建一个Looper对象,因此不能在子线程中直接显示Toast;

解决:
有两种方法:
1、在开启的子线程中执行Looper.prepare()来构建一个Looper,然后在显示Toast,但是不要忘记执行Looper.loop()来加载这个Looper,
2、直接使用主线程的Looper对象;获取主线程的Looper的方法是Looper.getMainLooper()

8、Android Studio 执行 lint task的时候 可能会遇到如下错误。Execution failed for task ':app:lint'.> Lint found errors in the project; aborting build.

解决:
只要在当前app的app/build.gradle文件内增加如下代码,

android {  

lintOptions {      

abortOnError false  

    }    
}

9、INSTALL_FAILED_NO_MATCHING_ABIS 安装包安装失败

解决:

由于本机设备是x86架构,而所运行的项目为arm架构,只需要在项目的build.gradle中的android中加入以下代码:

splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a'
            universalApk true
        }
    }

10、Error: Default interface methods are only supported starting with Android N (-- min-api 24)

原因分析: java8才支持静态接口方法,Android N 要求jdk版本为1.8
解决:

定义和调用静态接口方法的module编译时都使用jdk1.8即可;

11、Unity工程导出Android apk失败,错误信息如下:

错误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)一项,其他不变;如下图:

12、Could not find com.android.tools.build:aapt2:3.3.2-5309881.

错误信息:

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'
        }
    }
}

13、项目编译阶段出现错误:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileJava'

解决:

在AndroidStudio的terminal中输入 gradle compileDebugSource --stacktrace -info 命令,重新编译查看gradle的具体报错信息,如果报错中类似 processDebugManifest 信息的,同样把可以使用 gradle processDebugManifest 跟进出错的位置,以此类推,直到找到最终的错误位置;

14、studio配置了忽略提交文件*.iml ,但是提交的时候.iml结尾的文件仍然在svn显示的问题

解决:

打开Preferences,在如下图中红色线圈住的位置添加*.iml,即可解决

15、ERROR: The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin

分析: module中build.gradle下的instrumentTest.setRoot(‘tests’) ,instrumentTest已经在旧版本中被弃用导致;

解决:

使用 androidTest 替换 instrumentTest 即可;

16、Unknown failure: Failure - not installed for 0 Error while Installing APKs

解决:

删除studio项目app下的build文件,然后重新编译;

(注:网上有的方案是在手机设置——>开发者选项——>关闭MIUI优化,有的是开启未知来源软件安装,但这两个方法对我的问题不管用,最后删除build文件夹好使了)

17、com.android.tools.r8.CompilationFailedException: Compilation failed to complete

分析:引用的包冲突、引用的依赖库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'
    }
}

18、om.android.tools.lint:lint-gradle:26.4.0 > com.android.tools.build:builder:3.4.0 > com.android.tools.build:apkzlib:3.4.0

解决:

打开项目的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'
        }
    }
}

19、打签名apk包报错:Could not find org.codehaus.groovy:groovy-all:2.4.15.

解决:

方法同18,在项目的build.gradle中添加google库和jcenter库,顺序必须google库在前

allprojects {
    repositories {
        //添加google库和jcenter库,顺序必须google库在前
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

20、libiPhone-lib.a错误 

unity导出xcode工程报libiPhone-lib.a错误 

解决:

在build setting中找到 other link flags  添加三项:-Wl    -undefined    dynamic_lookup

21、使用adb命令安装报错:INSTALL_FAILED_INSUFFICIENT_STORAGE

解决:

studio编译安装apk时提示此问题,是由于手机的存储空间不足,删除一些APP即可;

22、Could not resolve all files for configuration ':app:debugRuntimeClasspath',并提示某个libs下的包找不到

出现该问题的背景,一个工程依赖一个library,这个library接入了第三方的SDK;

解决:

将整个工程进行编译时,需要在app的build.gradle中的repositories中加入library的libs路径,如下方式:

23、java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

问题:在使用DialogFragment过程中出现,

解决:

摒弃commit方法提交Dialog,改为commitAllowingStateLoss,同时dismiss的时候改为dismissAllowingStateLoss

24、AGPBI: {"kind":"error","text":"Invoke-customs are only supported starting with Android O (--min-api 26)","sources":[{}],"tool":"D8"}

解决:

需要在项目的build.gradle中指定jdk版本

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

25、使用命令行安装下载AndroidSDK,操作SDKManager下载文件时提示:

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这个路径必须是死的。

如下图:

26、Android Studio在build.gradle中动态修改项目下的gradle.properties文件内容

//示例,修改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文件"
    }
}

27、CPU架构不兼容

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)

解决:

调试手机设备CPU架构为arm64-v8a,但是编译环境设置的兼容架构不包含该架构模式,需要在module下的build.gradle中添加该架构。如下:

ndk {
    abiFilters 'armeabi-v7a', 'x86','arm64-v8a'
}

28、Android studio编译工程提示:> java.net.MalformedURLException: no protocol:

解决:

检查工程路径是否包含空格,中划线【-】等不规范目录名

29、error: resource android:attr/offset not found.  error: failed linking references.

解决:

如果资源存在的情况下,需要检查compileSdkVersion和buildToolsVersion版本是否一致。

30、无法访问GitHub,从Git拉取代码失败问题

解决:

由于审核问题,具体参考:git 本地无法访问github解决方案 - ITFengHua - 博客园

31、Untiy游戏启动自动申请Android存储权限

解决:

在AndroidManifest.xml文件的Application节点下添加如下代码:

 <application

    <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true"/>

    ......
</application>

32、Unity游戏启动时自动获取了android_id等设备信息

解决:

  1. 移除analytics package :去package manager 窗口移除即可,然后上传manifest.json。
  2. File-BuildSettings-PlayerSettings,勾选Disable HW Statistics*。对应的文件是ProjectSettings.asset的 【submitAnalytics: 1】修改成 【submitAnalytics: 0】。(Disable HW Statistics* 禁用硬件统计,在启用的情况下,应用程序会将匿名硬件统计信息发送到Unity,反之,则不发送。注意:务必查看ProjectSettings.asset中是否修改成功,有的Unity版本界面修改不生效。

如果不移除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;
    }

33、在app运行过程中,前往设置界面将app已经拥有的动态权限手动关闭,再返回到app时,会出现重启现象,如果app没有做现场数据保护,即有可能出现空指针、数组越界等异常。

解决:

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;
    }    
}

34、游戏编译时报错如下:

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
}

35、gradle编译apk包,assets下的文件有遗漏没有打包进apk包内。

解决:

Android gradle资源编译使用AAPT2,在打包assets资源时,在不配置aaptOptions时,使用默认的打包规则,即assets下以下划线“_”开头的目录或文件将会忽略,不会打包到apk内,针对此情况有两种解决方案:

一:修改assets下的文件目录或文件名称。

二:配置aaptOptions的ignoreAssetsPattern规则,如:

android {
    aaptOptions {
        noCompress ''
        ignoreAssetsPattern "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }
}

36、You need to use a Theme.AppCompat theme (or descendant) with this activity

解决:

根据报错提示的意思是,针对继承了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必须有父类,这里重复了,且没有父类,把重复的删除掉即可。

37、游戏切后台返回后出现黑屏

解决:

在unityPlayerActivity的onStart方法里,添加代码:

onWindowFocusChanged(true);

unity版本:2019.4.40f1

38、studio打包提示Failed to transform artifact ‘xxx.jar’ to match attributes

解决:

需要再gradle.properties文件中配置:

android.useAndroidX=false
android.enableJetifier=false

39、横屏游戏跳转三方竖屏应用,返回后闪退,在小米12机型,Android13系统,偶现,几率60%以上

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.

原因:游戏使用的三方播放器导致在计算图片的时候错误,创建了尺寸为2400*16777215的对象,引发oom。

解决:

待修复。

40、mysql出现报错:Package for query is too large (xxxxxxxx > 4194304). You can change this value on the server by setting the max_allowed_package variable

解决:

max_allowed_packet是 MySQL 中的一个设定参数,用于设定所接受的包的大小,查看当前机器mysql配置的大小,可以通过查看 /etc/my.cnf文件,其中max_allowed_packet = 1024M即为上述报错的上限值,调整该值即可,然后重启mysql。

41、AAPT: error: unexpected element <property> found in <manifest><application>.

解决:

在Android项目级build.gradle中,修改Gradle插件版本为4.2.1及以上

dependencies {
    classpath 'com.android.tools.build:gradle:4.2.1'
}

其对应的Gradle版本必须为6.7.1及以上。

42、SplitApkInstallerBase: Failed to commit install session 388416319 with command package install-commit 388416319. Error: INSTALL_FAILED_TEST_ONLY: installPackageLI

问题场景:打出的Google AAB包,使用bundletool方式安装apks,报以上错误。

分析:App的清单文件里被标识了“测试应用”,这个标志告诉系统只能将应用安装到通过 USB 连接的开发设备上,而不能通过 Google Play 等渠道分发给普通用户。

解决:

去掉该属性即可。

<application
        android:testOnly="true">

    </application>

43、海外接入Firebase crashlyties启动报错:java.lang.RuntimeException: Unable to get provider

java.lang.RuntimeException: Unable to get provider
com.google.firebase.provider.FirebaseInitProvider: 
java.lang.IllegalStateException: The Crashlytics build ID is missing. 
This occurs when the Crashlytics Gradle plugin is missing from your app's build configuration. 
Please review the Firebase Crashlytics onboarding instructions at https://firebase.google.com/docs/crashlytics/get-started?platform=android#add-plugin

分析:缺少Firebase crashlytis插件。

解决:

1、在根目录的build.gradle中添加插件

allprojects {
    buildscript {
        repositories {
            google()
            mavenCentral() 
        }
        dependencies {
            // gradle
            classpath 'com.android.tools.build:gradle:7.1.2'

            //添加如下插件:firebase-crashlytics
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
        }
    }
}

2、在module级的build.gradle

//最顶部添加crashlytics插件依赖
apply plugin: 'com.google.firebase.crashlytics'

//dependencies中添加crashlytics仓库依赖
dependencies {
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-crashlytics-ndk'
}

44、Untiy启动会自动读取应用安装列表:android.app.ApplicationPackageManager.queryIntentActivities(Native Method)

android.app.ApplicationPackageManager.queryIntentActivities(Native Method)
   com.unity3d.player.UnityPlayer.nativeRender(Native Method)
   com.unity3d.player.UnityPlayer.access$300(Unknown Source)
   com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source)
   android.os.Handler.dispatchMessage(Handler.java:98)
   android.os.Looper.loop(Looper.java:148)
   com.unity3d.player.UnityPlayer$e.run(Unkno

目前已知的会自动读取设备应用安装列表的unity版本有:2019.4.40f1、2020.2.7f1、2021.2.18f1

解决:

根据unity官方和本地实测,已修复的版本有:

  1. 2019.4.40f1
  2. 2020.3.37f1
  3. 2021.3.6f1
  4. 2022.1.8f1
  5. 2022.2.0a19

unity官方回复参考:https://discussions.unity.com/t/unity-call-queryintentactivitiesasuser-on-start-up-violate-privacy-policy/864752/4

45、Android Studio打包报错:Direct local .aar file dependencies are not supported when building an AAR.

解决:

App工程依赖了一个Module库,Module库中的libs下有aar文件,此时在Module库的build.gradle文件中需要配置:

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {

    //这种方式会导致报以上错误,需要改为下面的方式    
    implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
    //需要改为这种方式,同时去掉上面include数组中的'*.aar'过滤
    implementation(name:'填写aar文件名称,不带后缀名', ext: 'aar')

}

同时App的build.gradle文件中需要添加对Module/libs的仓库引用:

repositories {
    flatDir {
        dirs 'libs'
        dirs project(':Module名称').file('libs')
    }
}

46、海外项目编译报错:Could not resolve all files for configuration ':Demo:releaseRuntimeClasspath'.

Execution failed for task ':Demo:mergeExtDexRelease'.
> Could not resolve all files for configuration ':Demo:releaseRuntimeClasspath'.
   > Failed to transform play-services-measurement-api-21.5.0.aar (com.google.android.gms:play-services-measurement-api:21.5.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=false, dexing-min-sdk=21, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/heshuiguang/.gradle/caches/transforms-3/94ab06534445a23caa9ced209c55acfe/transformed/jetified-play-services-measurement-api-21.5.0-runtime.jar.
         > Error while dexing.

使用版本:

Android Gradle Plugin:7.4.2

Gradle:7.5

jdk:11.0.19

解决:

根据报错信息提示,dexing-min-sdk=21,表明项目的最小SDK版本不兼容,需要提升MinSDKVersion,改为24即可。

47、Facebook分享没有回调

解决:

//CallbackManager的创建对象必须是全局的,保证调用和onActivityResult中的是一个。
CallbackManager callbackManager = CallbackManager.Factory.create();


//调用入参必须是同一个callbackManager对象
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
    @Override
    public void onSuccess(Sharer.Result result) {
    
    }
    @Override
    public void onCancel() {
    
    }
    @Override
    public void onError(@NotNull FacebookException e) {
    
    }           
});


//onActivityResult回调必须是同一个callbackManager对象
public static void onActivityResult(int requestCode, int resultCode, Intent data) {
   callbackManager.onActivityResult(requestCode, resultCode, data);
}

48、“Journey Renewed: Fate Fantasy”的请求不符合 Google 的“使用安全浏览器”政策。如果此应用有对应的网站,您可打开网络浏览器并尝试从该网站中登录。如果您正尝试访问无线网络,请按照这些说明操作。

解决

Google登录禁止在App内嵌的Webview中打开,以下来自Google官网截图,具体可以参考官网:使用支持的浏览器登录

49、unity出mac版本的包报错:error CS0234: The type or namespace name 'PackageManager' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

解决:

需要对unity编辑器的引用包做判断,在引用位置添加如下判断:

using System;
using System.Text;
.......

//加判断宏后
#if UNITY_EDITOR //若是编辑器状态
using UnityEditor;
using UnityEditor.PackageManager;
#endif

.......
using System.Linq;

50、有关Vuplex 3DWebView在Android 8、9系统上反编译重打包导致的闪退问题

问题背景:

使用apktool工具反编译游戏母包,然后塞入渠道资源,再组装成一个studio工程,使用Gradle方式重新打包apk,在apk在Android 8和9系统上报错,10以及10以上系统正常。

报错信息:

10:07:14.054 DEBUG             A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10:07:14.054 DEBUG             A  Build fingerprint: 'HUAWEI/MHA-AL00/HWMHA:9/HUAWEIMHA-AL00/9.1.0.228C00:user/release-keys'
10:07:14.054 DEBUG             A  Revision: '0'
10:07:14.054 DEBUG             A  ABI: 'arm64'
10:07:14.055 DEBUG             A  Happend: 'Fri Jan  3 10:07:14 2025
                                  '
10:07:14.055 DEBUG             A  SYSVMTYPE: Art
                                  APPVMTYPE: Art
10:07:14.055 DEBUG             A  pid: 17173, tid: 17269, name: UnityMain  >>> com.changyou.bbtl <<<
10:07:14.055 DEBUG             A  signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40
10:07:14.055 DEBUG             A  Cause: null pointer dereference
10:07:14.055 DEBUG             A      x0  00000000131e0dc8  x1  0000000000000000  x2  0000007267800000  x3  0000000000000006
10:07:14.055 DEBUG             A      x4  00000000000000a8  x5  00000000725162fb  x6  0000000000000004  x7  000000000000000f
10:07:14.055 DEBUG             A      x8  0000007299d6e400  x9  0000007295526448  x10 0000000000000070  x11 0000000000000001
10:07:14.055 DEBUG             A      x12 0000000000000001  x13 0000000000000064  x14 0000000000000000  x15 0000000000000006
10:07:14.055 DEBUG             A      x16 00000073393efbe8  x17 00000073393842e8  x18 0000000012e400f8  x19 0000000000000000
10:07:14.055 DEBUG             A      x20 000000729920447c  x21 0000000000000000  x22 00000000131e0dc8  x23 0000000012e7bda0
10:07:14.055 DEBUG             A      x24 00000072b7fe3300  x25 00000000000064a8  x26 0000000012e7bda0  x27 0000000012e7bda0
10:07:14.055 DEBUG             A      x28 00000072b7fe3ed8  x29 0000007295525bf0
10:07:14.055 DEBUG             A      sp  0000007295525bc0  lr  00000072b7c01d2c  pc  00000072b7c0c3f8
10:07:14.070 DEBUG             A  
                                  backtrace:
10:07:14.070 DEBUG             A      #00 pc 000000000028e3f8  /system/lib64/libart.so (_ZN3art6mirror6Object18VerifierInstanceOfILNS_17VerifyObjectFlagsE0EEEbNS_6ObjPtrINS0_5ClassEEE+24)
10:07:14.070 DEBUG             A      #01 pc 0000000000283d28  /system/lib64/libart.so (_ZN3art11interpreter10DoFieldPutILNS_13FindFieldTypeE5ELNS_9Primitive4TypeE0ELb1ELb0EEEbPNS_6ThreadERKNS_11ShadowFrameEPKNS_11InstructionEt+1196)
10:07:14.070 DEBUG             A      #02 pc 00000000002a1090  /system/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+71064)
10:07:14.070 DEBUG             A      #03 pc 000000000058bf38  /system/lib64/libart.so (ExecuteSwitchImplAsm+8)
10:07:14.071 DEBUG             A      #04 pc 0000000000aee868  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/oat/arm64/base.vdex (com.vuplex.webview._$$Lambda$WebView$_TNDhclvxjwvjo1mWcYIkcVaygI.<clinit>)
10:07:14.071 DEBUG             A      #05 pc 0000000000260ba4  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4077428924+392)
10:07:14.071 DEBUG             A      #06 pc 0000000000533b1c  /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
10:07:14.071 DEBUG             A      #07 pc 00000000005896fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
10:07:14.071 DEBUG             A      #08 pc 000000000058084c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
10:07:14.071 DEBUG             A      #09 pc 00000000000d8628  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
10:07:14.071 DEBUG             A      #10 pc 00000000001308b8  /system/lib64/libart.so (art::ClassLinker::InitializeClass(art::Thread*, art::Handle<art::mirror::Class>, bool, bool)+2240)
10:07:14.071 DEBUG             A      #11 pc 000000000011bb78  /system/lib64/libart.so (art::ClassLinker::EnsureInitialized(art::Thread*, art::Handle<art::mirror::Class>, bool, bool)+192)
10:07:14.071 DEBUG             A      #12 pc 0000000000274c48  /system/lib64/libart.so (_ZN3art11interpreter10DoFieldGetILNS_13FindFieldTypeE4ELNS_9Primitive4TypeE0ELb1ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEt+1264)
10:07:14.071 DEBUG             A      #13 pc 000000000029ebfc  /system/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+61700)
10:07:14.071 DEBUG             A      #14 pc 000000000058bf38  /system/lib64/libart.so (ExecuteSwitchImplAsm+8)
10:07:14.071 DEBUG             A      #15 pc 0000000000aed800  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/oat/arm64/base.vdex (com.vuplex.webview.WebView.resumeAll)
10:07:14.071 DEBUG             A      #16 pc 0000000000260ba4  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4077428924+392)
10:07:14.071 DEBUG             A      #17 pc 00000000002666f8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
10:07:14.071 DEBUG             A      #18 pc 00000000002877f8  /system/lib64/libart.so (bool art::interpreter::DoCall<false, true>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1792)
10:07:14.071 DEBUG             A      #19 pc 00000000002a82ec  /system/lib64/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE0ELb0ELb1EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+148)
10:07:14.071 DEBUG             A      #20 pc 00000000002a14b4  /system/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+72124)
10:07:14.071 DEBUG             A      #21 pc 000000000058bf38  /system/lib64/libart.so (ExecuteSwitchImplAsm+8)
10:07:14.071 DEBUG             A      #22 pc 0000000000aeac84  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/oat/arm64/base.vdex (com.vuplex.webview.WebView3D.resumeAll)
10:07:14.071 DEBUG             A      #23 pc 0000000000260ba4  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4077428924+392)
10:07:14.071 DEBUG             A      #24 pc 0000000000533b1c  /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
10:07:14.071 DEBUG             A      #25 pc 00000000005896fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
10:07:14.071 DEBUG             A      #26 pc 000000000058084c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
10:07:14.071 DEBUG             A      #27 pc 00000000000d8628  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
10:07:14.071 DEBUG             A      #28 pc 000000000047b374  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
10:07:14.071 DEBUG             A      #29 pc 000000000047c030  /system/lib64/libart.so (art::InvokeWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+408)
10:07:14.071 DEBUG             A      #30 pc 0000000000370934  /system/lib64/libart.so (art::JNI::CallStaticVoidMethodA(_JNIEnv*, _jclass*, _jmethodID*, jvalue*)+636)
10:07:14.071 DEBUG             A      #31 pc 0000000000223af8  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #32 pc 0000000000228848  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #33 pc 00000000022977d8  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libil2cpp.so
10:07:14.071 DEBUG             A      #34 pc 000000000229e6f4  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libil2cpp.so
10:07:14.071 DEBUG             A      #35 pc 00000000009c89f8  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libil2cpp.so
10:07:14.071 DEBUG             A      #36 pc 00000000009c886c  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libil2cpp.so
10:07:14.071 DEBUG             A      #37 pc 0000000000576b94  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #38 pc 0000000000584d6c  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #39 pc 00000000005948e8  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #40 pc 0000000000379c78  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #41 pc 0000000000468844  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #42 pc 000000000046c8e8  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #43 pc 000000000060d02c  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #44 pc 000000000060d2ec  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #45 pc 0000000000623790  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/lib/arm64/libunity.so
10:07:14.071 DEBUG             A      #46 pc 00000000000475fc  /data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/oat/arm64/base.odex (offset 0x3e000) (com.unionpay.mobile.android.pboctransaction.sdapdu.NativeSDWriter.closeSD [DEDUPED]+124)
10:07:14.071 DEBUG             A      #47 pc 000000000000fc44  /dev/ashmem/dalvik-jit-code-cache (deleted)

排查线索:

根据报错日志,排查到关键信息:

data/app/com.changyou.bbtl-SPlCgOONU-kgoeHk-apNAA==/oat/arm64/base.vdex (com.vuplex.webview._$$Lambda$WebView$_TNDhclvxjwvjo1mWcYIkcVaygI.<clinit>)

vuplex.webview是一个在unity中使用的三方Webview组件,可以看到它内部使用了兰姆达表达式,而apktool工具在反编译的时候无法将使用了兰姆达表达式的代码正确反编译出来,导致在引用了使用兰姆达表达式的代码出现找不到的情况。

解决方案:

把反编译后母包里的vuplex.webview相关的代码全部删除,然后使用jar包的方式引入studio工程中重新打包即可。

51、海外项目对接AppsFlyer v6.16.0版本,在Android Gradle插件版本7.1.2,Gradle版本7.5,jdk版本17环境编译报错,报错日志如下:

One or more classes has class file version >= 56 which is not officially supported.
com.android.tools.r8.internal.YI0: Sealed classes are not supported as program classes
One or more classes has class file version >= 56 which is not officially supported.

One or more classes has class file version >= 56 which is not officially supported.
com.android.tools.r8.internal.YI0: Sealed classes are not supported as program classes
One or more classes has class file version >= 56 which is not officially supported.

解决方案:

在项目级build.gradle文件中添加:

buildscript {
    repositories {
        mavenCentral()
        google()

        //AppsFlyer SDK v6.16.0+需要
        maven { url = uri("https://storage.googleapis.com/r8-releases/raw") }

        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'

        //AppsFlyer SDK v6.16.0+需要
        classpath("com.android.tools:r8:8.2.26")
    }
}

52、Google登录失败,返回code=10,message=10

解决方案:

该为App签名证书与Google后台上传的Sha1值不一样导致,需更换正确的签名证书

更新于2025.3.12

持续更新...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值