2017-02-26 3 views
2

Ich habe Probleme beim Starten meiner App, da sie den Fehler "Standardaktivität nicht gefunden" enthält. Ich habe andere Threads gelesen und habe versucht, die Position des folgenden Codes hinzuzufügen/zu ändern:Standardaktivität nicht gefunden Fehler Android Studio

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

aber es funktioniert immer noch nicht. Ich habe auch versucht

File -> Invalidate Caches/Restart... 

und immer noch nicht funktioniert. Unten ist meine Android Manifest.xml-Datei. Ich möchte meine App mit der Aktivität ".Main2Activity" starten. Beachten Sie auch, dass meine .xml-Dateien im Design-Modus aus irgendeinem Grund mit einem schwarzen Hintergrund und seltsamerweise anders aussehen.

<?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:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

    <uses-feature 
     android:name="android.hardware.camera" 
     android:required="true" /> 

    <activity android:name=".MainActivity" /> 
    </activity> 


    <activity android:name=".Dining" /> 
    <activity android:name=".SignUp" /> 

    <provider 
     android:name="android.s 


     upport.v4.content.FileProvider" 
     android:authorities="com.example.android.fileprovider" 
     android:exported="false" 
     android:grantUriPermissions="true"> 
     <meta-data 
      android:name="android.support.FILE_PROVIDER_PATHS" 
      android:resource="@layout/file_paths" /> 
    </provider> 
    <!-- 
     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="AIzaSyD37TQWZ02Re5_3lTH-kL17cOOVQw1B8dY" /> 

    <activity> 
     android:name=".MapsActivity" 
     android:label="@string/title_activity_maps" /> 


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

    <activity android:name=".MapsMain"></activity> 
</application> 

Antwort

2
<activity> 
     android:name=".MapsActivity" 
     android:label="@string/title_activity_maps" /> 

Scheck, Sie müssen für die Fehler in XML haben. Es wird sein:

<activity 
     android:name=".MapsActivity" 
     android:label="@string/title_activity_maps" /> 

ist es nicht?

0

Haben Sie versucht: https://stackoverflow.com/a/22028681/1101730.

diese Zeilen in die build.gradle Datei im Android hinzufügen {...} Block:

android { ... sourceSets { main.java .srcDirs + = 'src/main /' }

Klicken Sie nach dem Bearbeiten der Datei auf Tools> Android> Projekt mit Gradle-Dateien synchronisieren.

Das letzte, was mir einfällt, ist, auf Ausführen> Konfiguration bearbeiten zu klicken und sicherzustellen, dass Ihre Aktivität als Startaktivität ausgewählt ist.

Verwandte Themen