[英]Unable to find explicit activity class {}; have you declared this activity in your AndroidManifest.xml Maps API not workingg ;( Java Android Studio?
I have developed a simple app that allows users to login to a maps API and navigate around town.我开发了一个简单的应用程序,允许用户登录到地图 API 并在城镇中导航。 I do not know why it is not working like this is the error,我不知道为什么它不能像这样工作是错误,
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.vumaps/com.example.vu.MapActivity}; have you declared this activity in your AndroidManifest.xml?
then in mainactivity I have this and nothing is wrong.然后在mainactivity中我有这个并且没有错。 The app launches, allows me to use log in screen then crashes after login.该应用程序启动,允许我使用登录屏幕,然后在登录后崩溃。 Do u know why it does not work?你知道为什么它不起作用吗? there are zero errors in code except for this one:除了这个之外,代码中的错误为零:
<?xml version="1.0" encoding="utf-8"?>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the "MyLocation" functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.vumaps" >
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Just pretent the API key is here" />
<activity
android:name=".MapActivity"
android:exported="true"
android:label="@string/title_activity_maps" />
<activity
android:name=".MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
//villanova university app dev
//维拉诺瓦大学应用程序开发
More codes更多代码
if(username.getText().toString().equals("Student") && password.getText().toString().equals("Student")){ //correct Intent intent = new Intent(MainActivity.this, idkWhatToPutHere.MapActivity.class); startActivity(intent);
Your package name in the manifest is com.example.vumaps.您在清单中的 package 名称是 com.example.vumaps。 Your fully qualified class name is com.example.vu.MapActivity.您的完全限定 class 名称是 com.example.vu.MapActivity。 Using.MapActivity tells it to look for a class relative to the package name. Using.MapActivity 告诉它查找相对于 package 名称的 class。 Since this doesn't match, it can't find the activity in the manifest.由于这不匹配,它无法在清单中找到活动。 To fix this, either rename the package of.MapActivity, or use the fully qualified name instead of.MapActivity.要解决此问题,请重命名 .MapActivity 的 package,或使用完全限定名称而不是 .MapActivity。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.