Treewallie
Treewallie

Reputation: 356

Getting error when trying to run debugger in Android Studio

What currently happens: when I make a breakpoint on a method and right click to select Debug VendorMapsActivity it gives me an error saying "Error running VendorMapsActivity: this activity must be exported or contain an intent-filter."

What needs to happen: I need to be able to debug a method that is supposed to be called when the user swipe closes the app and deletes their data from Firebase Auth and Firebase Database Uid. I need to see if the method is running the way it needs to. Because as of now, the method itself is not removing any data from the Firebase Database.

What I have done: I have selected the debug variant in my build. I have added a build type of debug in my gradle. I also have the VendorMapsActivity in my Manifest file.

Manifest code:

   <?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.zzyzj.man">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<application
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:roundIcon="@drawable/logo"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:ignore="GoogleAppIndexingWarning">

    <activity android:name=".login.EatLoginActivity"
        android:screenOrientation="portrait"
        android:label="@string/app_name"/>
    <activity android:name=".login.VendorLoginActivity"
        android:screenOrientation="portrait"
        android:label="@string/app_name" />
    <activity
        android:name=".WelcomeActivity"
        android:screenOrientation="portrait"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

  <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="@string/testAppId"/>

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_eater_maps"
        android:screenOrientation="portrait">

    </activity>


    <activity
        android:name=".VendorMapsActivity"
        android:label="@string/title_activity_vendor_maps"
        android:screenOrientation="portrait"/>
</application>

 </manifest>

Gradle code:

android {

compileSdkVersion 27
defaultConfig {
    applicationId "com.example.zzyzj.man"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
    }
    debug {
        debuggable true
    }
}

}

What I am actually trying to debug:

 @Override
protected void onDestroy() {
    super.onDestroy();
    //TODO: Remove me.  Debug only!
    while (!Debug.isDebuggerConnected()) {
        try {
            Log.d(TAG, "Waiting for debugger");
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    //TODO: Figure out how to delete UID and user when they sign out
    removeAnonymousVendorUser();
    FirebaseAuth.getInstance().signOut();
    finish();
}

Upvotes: 0

Views: 543

Answers (1)

Justin Joseph
Justin Joseph

Reputation: 57

Not going too deep, try checking for updates in Android Studio. If there are any please do them and then restart 'Android Studio'

It worked for me :)

Upvotes: 1

Related Questions