gpt4 book ai didi

java - Intent-filter 在 Android Studio 中构建两个应用程序而不是一个应用程序

转载 作者:行者123 更新时间:2023-12-02 04:57:05 27 4
gpt4 key购买 nike

我有一个与 onesignal 通知集成的 React Native 项目,在 Android 应用程序中,当我使用 Android Studio 构建我的应用程序时,它会安装两个应用程序,一个名为 onesignal,另一个是我的主应用程序,并且应用程序运行完美

我试图从我的 Activity 中删除 Intent

       <activity android:name="bkholdnews.beonews.MainActivity" android:label="OneSignal Example" android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

并重建应用程序,它安装了一个应用程序,但当我打开它时,它说应用程序一直在弯腰!

我的 MainActivity 代码

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hhz20.bkholdnews"
android:versionCode="29"
android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <!-- Approximate location - If you want to use promptLocation for letting OneSignal know the user location. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!-- Precise location If you want to use promptLocation for letting OneSignal know the user location. -->

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />

<application
android:name="bkholdnews.beonews.MainApplication"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:usesCleartextTraffic="true"
android:largeHeap="true"
android:supportsRtl="true"
android:label="@string/app_name"
android:icon="@drawable/icon"
android:theme="@style/SplashTheme">

<activity
android:launchMode="singleTop"
android:name="bkholdnews.beonews.SplashActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name="bkholdnews.beonews.MainActivity" android:label="OneSignal Example" android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
</application>

</manifest>

崩溃日志

    --------- beginning of crash
2019-06-01 17:31:18.598 30803-30803/com.hhz20.bkholdnews E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hhz20.bkholdnews, PID: 30803
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hhz20.bkholdnews/bkholdnews.beonews.SplashActivity}: android.content.res.Resources$NotFoundException: Drawable com.hhz20.bkholdnews:drawable/splash_screen with resource ID #0x7f0700b1
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.content.res.Resources$NotFoundException: Drawable com.hhz20.bkholdnews:drawable/splash_screen with resource ID #0x7f0700b1
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/splash_screen.xml from drawable resource ID #0x7f0700b1
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:847)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:631)
at android.content.res.Resources.getDrawableForDensity(Resources.java:888)
at android.content.res.Resources.getDrawable(Resources.java:827)
at android.content.Context.getDrawable(Context.java:626)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:463)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:203)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:86)
at android.support.v7.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:260)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:182)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:520)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
at bkholdnews.beonews.SplashActivity.onCreate(SplashActivity.java:9)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: <bitmap> requires a valid 'src' attribute
at android.graphics.drawable.BitmapDrawable.updateStateFromTypedArray(BitmapDrawable.java:849)
at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:770)
at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142)
2019-06-01 17:31:18.599 30803-30803/com.hhz20.bkholdnews E/AndroidRuntime: at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1332)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1321)
at android.graphics.drawable.LayerDrawable.inflateLayers(LayerDrawable.java:279)
at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:194)
at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142)
at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1332)
at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1291)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:833)
... 27 more
2019-06-01 17:31:18.612 30803-30803/com.hhz20.bkholdnews I/Process: Sending signal. PID: 30803 SIG: 9

最佳答案

您可能必须从 list 文件中的主 Activity 中删除 Intent 过滤器,并通过启动屏幕启动 Activity 事务到主 Activity ,并从主 Activity 中删除启动模式

关于java - Intent-filter 在 Android Studio 中构建两个应用程序而不是一个应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56405257/

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