gpt4 book ai didi

安卓.content.res.Resources$NotFoundException : Resource ID #0x7f060052

转载 作者:太空宇宙 更新时间:2023-11-03 13:44:37 24 4
gpt4 key购买 nike

我已经用这种方法实现了启动 Activity https://android.jlelse.eu/right-way-to-create-splash-screen-on-android-e7f1709ba154它适用于我的 Android 7.0,但它在 Android 4.4.4 和 4.1.1 上崩溃我已经检查了 stackoverflow 上的许多线程,它们对我不起作用。

我在 drawable 目录中有这个 splash.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/waze_blue_bg" />
<item android:top="-120dip">
<bitmap android:src="@drawable/ill_intro_logo"
android:gravity="center" />
</item>
</layer-list>

样式.xml

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
</style>

AndroidManifest.xml

<activity
android:name=".splash.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

SplashActivity.kt

class SplashActivity : AppCompatActivity() {

val SPLASH_DISPLAY_LENGTH = 2000L

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

Handler().postDelayed(Runnable {
startActivity(Intent(this, TutorialPagerActivity::class.java))
finish()
}, SPLASH_DISPLAY_LENGTH)

}
}

堆栈跟踪:

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.williams.travelshare/com.williams.travelshare.splash.SplashActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f060052
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f060052
at android.content.res.Resources.getValue(Resources.java:1013)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:330)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:755)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:85)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:128)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:149)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:29)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:54)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:206)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:519)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
at com.williams.travelshare.splash.SplashActivity.onCreate(SplashActivity.kt:14)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
07-13 10:44:24.791 345-347/? E/SocketStream: readFully was waiting for 716352 bytes, got 16192

最佳答案

它看起来像 android 端的错误。我通过在 gradle.properties

中禁用 android.enableAapt2 来修复它

android.enableAapt2=false

你可以在这里查看https://issuetracker.google.com/issues/63642784

关于安卓.content.res.Resources$NotFoundException : Resource ID #0x7f060052,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45079240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com