在我的 android 应用程序中,我在清单文件中添加了一个活动MainActivity,在使用 inten 导航到该活动时,我会activity not found error
询问我是否已将其添加到清单中
这是我的清单活动
<activity
android:name=".MainActivity"
android:clearTaskOnLaunch="true"
android:configChanges="orientation|keyboardHidden|screenSize"
android:icon="@mipmap/ic_launcher"
android:rotationAnimation="seamless"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat"
tools:targetApi="O">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.OPENABLEk" />
</intent-filter>
<!-- Register as a system camera app-->
<intent-filter>
<action android:name="android.media.action.IMAGE_CAPTURE" />
<action android:name="android.media.action.STILL_IMAGE_CAMERA" />
<action android:name="android.media.action.VIDEO_CAMERA" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- App links for http/s -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="example.android.com" />
<data android:pathPattern="/camerax" />
</intent-filter>
<!-- Declare notch support -->
<meta-data
android:name="android.notch_support"
android:value="true" />
</activity>
这是日志
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.virtusync.scanningtool, PID: 28538
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.virtusync.scanningtool/com.android.example.cameraxbasic.MainActivityKt}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2005)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
at android.app.Activity.startActivityForResult(Activity.java:4586)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:675)
at android.app.Activity.startActivityForResult(Activity.java:4544)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:662)
at android.app.Activity.startActivity(Activity.java:4905)
at android.app.Activity.startActivity(Activity.java:4873)
at com.android.example.cameraxbasic.SelectOperation$1.onClick(SelectOperation.java:36)
at android.view.View.performClick(View.java:7044)
at android.view.View.performClickInternal(View.java:7017)
at android.view.View.access$3200(View.java:784)
at android.view.View$PerformClick.run(View.java:26596)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6819)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:497)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:912)
我已经完成了 How to fix "android.content.ActivityNotFoundException" android-studio 2.3.3 no solution yet