华为广告打包时报错
fata日志不一样能反映出完整的错误日志信息,仅看fata日志具有误导性,有可能指向错误的方向。
通过看完整的日志可见,错误的原因为
Caused by: java.lang.ClassNotFoundException: com.huawei.hms.ads.base.R$dimen
fata日志
2024-03-25 20:24:27.674 3737-3737 AndroidRuntime usap64 E FATAL EXCEPTION: main
Process: cn.jj.chess.huawei, PID: 3737
java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.jj.chess.huawei/cn.jj.channel.ad.activity.HuaWeiSplashActivity}: android.view.InflateException: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Error inflating class com.huawei.hms.ads.splash.SplashView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4018)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4168)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2630)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Caused by: android.view.InflateException: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Error inflating class com.huawei.hms.ads.splash.SplashView
Caused by: android.view.InflateException: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Error inflating class com.huawei.hms.ads.splash.SplashView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:877)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1029)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:984)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1146)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1107)
at android.view.LayoutInflater.inflate(LayoutInflater.java:703)
at android.view.LayoutInflater.inflate(LayoutInflater.java:544)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:494)
at android.app.Activity.setContentView(Activity.java:3743)
at cn.jj.channel.ad.activity.HuaWeiSplashActivity.onCreate(HuaWeiSplashActivity.java:11)
at android.app.Activity.performCreate(Activity.java:8757)
at android.app.Activity.performCreate(Activity.java:8729)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1475)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3992)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4168)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2630)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
完整日志
一定要看完整的日志。
2024-03-25 20:16:31.488 2281-2281 AndroidRuntime usap64 D Shutting down VM
2024-03-25 20:16:31.488 2281-2281 AndroidRuntime usap64 E FATAL EXCEPTION: main
Process: cn.jj.chess.huawei, PID: 2281
java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.jj.chess.huawei/cn.jj.channel.ad.activity.HuaWeiSplashActivity}: android.view.InflateException: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Error inflating class com.huawei.hms.ads.splash.SplashView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4018)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4168)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2630)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Caused by: android.view.InflateException: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Error inflating class com.huawei.hms.ads.splash.SplashView
Caused by: android.view.InflateException: Binary XML file line #63 in cn.jj.chess.huawei:layout/tk_huawei_ad_splash_view: Error inflating class com.huawei.hms.ads.splash.SplashView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:877)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1029)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:984)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1146)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1107)
at android.view.LayoutInflater.inflate(LayoutInflater.java:703)
at android.view.LayoutInflater.inflate(LayoutInflater.java:544)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:494)
at android.app.Activity.setContentView(Activity.java:3743)
at cn.jj.channel.ad.activity.HuaWeiSplashActivity.onCreate(HuaWeiSplashActivity.java:11)
at android.app.Activity.performCreate(Activity.java:8757)
at android.app.Activity.performCreate(Activity.java:8729)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1475)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3992)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4168)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2630)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
2024-03-25 20:16:31.489 2281-2281 AndroidRuntime usap64 E Caused by: android.view.InflateException: Binary XML file line #13 in cn.jj.chess.huawei:layout/hiad_view_splash_ad: Binary XML file line #13 in cn.jj.chess.huawei:layout/hiad_view_splash_ad: Error inflating class com.huawei.openalliance.ad.views.PPSWLSView
Caused by: android.view.InflateException: Binary XML file line #13 in cn.jj.chess.huawei:layout/hiad_view_splash_ad: Error inflating class com.huawei.openalliance.ad.views.PPSWLSView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:877)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1029)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:984)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1146)
at android.view.LayoutInflater.inflate(LayoutInflater.java:673)
at android.view.LayoutInflater.inflate(LayoutInflater.java:544)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
at android.view.View.inflate(View.java:28939)
at com.huawei.openalliance.ad.views.PPSSplashView.V(Unknown Source:2)
at com.huawei.openalliance.ad.views.PPSSplashView.Code(Unknown Source:0)
at com.huawei.openalliance.ad.views.PPSSplashView.<init>(Unknown Source:52)
at com.huawei.hms.ads.splash.SplashView.<init>(Unknown Source:0)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:877)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1029)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:984)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1146)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1107)
at android.view.LayoutInflater.inflate(LayoutInflater.java:703)
at android.view.LayoutInflater.inflate(LayoutInflater.java:544)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:494)
at android.app.Activity.setContentView(Activity.java:3743)
at cn.jj.channel.ad.activity.HuaWeiSplashActivity.onCreate(HuaWeiSplashActivity.java:11)
at android.app.Activity.performCreate(Activity.java:8757)
at android.app.Activity.performCreate(Activity.java:8729)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1475)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3992)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4168)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2630)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Caused by: android.view.InflateException: Binary XML file line #10 in cn.jj.chess.huawei:layout/hiad_wls_view: Binary XML file line #10 in cn.jj.chess.huawei:layout/hiad_wls_view: Error inflating class com.huawei.hms.ads.splash.ChoicesView
Caused by: android.view.InflateException: Binary XML file line #10 in cn.jj.chess.huawei:layout/hiad_wls_view: Error inflating class com.huawei.hms.ads.splash.ChoicesView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
2024-03-25 20:16:31.489 2281-2281 AndroidRuntime usap64 E at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:877)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1029)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:984)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1146)
at android.view.LayoutInflater.inflate(LayoutInflater.java:673)
at android.view.LayoutInflater.inflate(LayoutInflater.java:544)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
at android.view.View.inflate(View.java:28939)
at com.huawei.openalliance.ad.views.PPSWLSView.Code(Unknown Source:2)
at com.huawei.openalliance.ad.views.PPSWLSView.<init>(Unknown Source:3)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:877)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1029)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:984)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1146)
at android.view.LayoutInflater.inflate(LayoutInflater.java:673)
at android.view.LayoutInflater.inflate(LayoutInflater.java:544)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
at android.view.View.inflate(View.java:28939)
at com.huawei.openalliance.ad.views.PPSSplashView.V(Unknown Source:2)
at com.huawei.openalliance.ad.views.PPSSplashView.Code(Unknown Source:0)
at com.huawei.openalliance.ad.views.PPSSplashView.<init>(Unknown Source:52)
at com.huawei.hms.ads.splash.SplashView.<init>(Unknown Source:0)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:877)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1029)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:984)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1146)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1107)
at android.view.LayoutInflater.inflate(LayoutInflater.java:703)
at android.view.LayoutInflater.inflate(LayoutInflater.java:544)
at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:494)
at android.app.Activity.setContentView(Activity.java:3743)
at cn.jj.channel.ad.activity.HuaWeiSplashActivity.onCreate(HuaWeiSplashActivity.java:11)
at android.app.Activity.performCreate(Activity.java:8757)
at android.app.Activity.performCreate(Activity.java:8729)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1475)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3992)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4168)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2630)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/huawei/hms/ads/base/R$dimen;
at com.huawei.hms.ads.splash.ChoicesView.Code(Unknown Source:8)
at com.huawei.hms.ads.splash.ChoicesView.<init>(Unknown Source:3)
... 55 more
2024-03-25 20:16:31.489 2281-2281 AndroidRuntime usap64 E Caused by: java.lang.ClassNotFoundException: com.huawei.hms.ads.base.R$dimen
... 57 more
收不到回调问题研究
添加华为闪屏页后,我们在java包中创建了一个activity,创建的此activity中的内容,没有进行防混淆。
导致华为this.splashView.load时传入的第var5参数异常。与逆向导入资源的名称不一致。程序虽然没有报错,但是一直收不到相关回调。
SplashView.SplashAdLoadListener var5;
var5 = new SplashView.SplashAdLoadListener() {
public void onAdLoaded() {
String[] var1;
(var1 = new String[1])[0] = "onAdLoaded";
LogUtils.logI("TK_HuaWeiSplashActivity", var1);
}
public void onAdFailedToLoad(int var1) {
String[] var2;
(var2 = new String[1])[0] = "onAdFailedToLoad";
LogUtils.logI("TK_HuaWeiSplashActivity", var2);
}
public void onAdDismissed() {
String[] var1;
(var1 = new String[1])[0] = "onAdDismissed";
LogUtils.logI("TK_HuaWeiSplashActivity", var1);
}
}.<init>();
String[] var3;
(var3 = new String[1])[0] = "splashAdLoadListener:" + <undefinedtype>.class;
LogUtils.logI("TK_HuaWeiSplashActivity", var3);
this.splashView.load(splash_ad_id, this.splash_game_orientation, var1, var5);