Getting error when trying to run debugger in Android Studio - android

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();
}

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 :)

Related

Firebase InstanceId: binding to the service failed: Kotlin

App successfully lanches but get this error message in debugging. FirebaseInstanceId: binding to the service failed
App Build Gradle:
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true // enable mun
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Android manifest:
<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/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".FilterPage"></activity>
<activity android:name=".filterdashboard" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have added
<uses-permission android:name="android.permission.INTERNET"/>
In my manifest file and got rid of Firebase InstanceId: binding to the service failed. Hope it will help.
I downloaded the newest version of google-service.json (can be done via Firebase Settings). In my case there was a new entry added to oauth_client. After syncing with the file system and rebuilding my app the warning does not seem to appear anymore.
EDIT 20-02-2020: After testing this a bit more it unfortunately doesn't seem to help in the end. In my case the error message only for sure occur when starting the app the first time after an uninstall of the app - in most other cases it does not happen.
Please try to use an actual device. Per my observation, you'll get this kind of error when you use an emulator even though you've already downloaded all the required libraries related to Google Services. I was also able to see other errors from FirebaseInstanceId.
In my case, login to Google Play on emulator (API: R) is fixed the problem. I think it's about Play Services.
Add service tag inside application tag
<application>
....
<activity
....
</activity>
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
Then add a new kotlin file - MyFirebaseMessagingService.kt
import com.google.firebase.messaging.FirebaseMessagingService;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
#Override
public void onNewToken(String s) {
super.onNewToken(s);
System.out.println("NEW_TOKEN :::::::::::::::::::::::::: "+s);
}
}
Uninstall the App manually and reinstall. This will work.

Supported Android Devices = zero

My app can't be found when someone looks for it from their google play app on their Android phone. (shows find when searched from browser). This is because Google Play says my app supports "0 devices".
The support chat person at Google play says this is the reason:
"Your app is not compatible with certain devices due to a conflict in your app’s manifest with the following: no supported native platform:
armeabi, armeabi-v7a, and missing device features: android.hardware.faketouch, android.hardware.screen.portrait"
I can't figure out what the heck that means.
My manifest file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deanblakely.SafeTalk"
android:installLocation="preferExternal"
android:versionCode="30"
android:versionName="1.06 " >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="25" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!--android:theme="#android:style/Theme.NoTitleBar" -->
<activity android:name="SplashActivity"
android:label="#string/app_name"
android:theme="#style/SplashTheme">
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="MainActivity"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="#style/AppTheme.NoActionBar"
>
</activity>
<receiver
android:name="com.deanblakely.SafeTalk.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.deanblakely.SafeTalk" />
</intent-filter>
</receiver>
<service android:name="com.deanblakely.SafeTalk.GcmIntentService" />
</application>
</manifest>
My gradle file is as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy' //httpClient not supported in 23.
lintOptions { disable 'MissingTranslation' }
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
}
signingConfigs {
releaseConfig {
storeFile file("XXXXXXXXXXXXXXXXX");
storePassword ("XXXXXXXXXX");
keyPassword ("XXXXXXXXXX");
keyAlias "XXXXX
}
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.releaseConfig
}
debug {
debuggable true
applicationIdSuffix ".debug"
}
}
flavorDimensions "stupidDimensionone"
productFlavors {
scFlavor
{
applicationId 'com.deanblakely.SafeTalk.sc'
dimension "stupidDimensionone"
}
safetalkFlavor
{
applicationId "com.deanblakely.SafeTalk"
dimension "stupidDimensionone"
}
}
}
dependencies {
compile project(':dropboxChooserSDK')
compile files('libs/gson-2.2.4.jar')
compile files('libs/microsoft-translator-java-api-0.6.2-jar-with-dependencies.jar')
compile 'com.android.support:appcompat-v7:25+'
compile 'com.android.support:design:25+'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
}
This didn't used to be this way. I suppose it is another breaking change. Anyone know what is causing this?
As usual I am answering my own question . . .
I made the following replacement in my gradle . . .
//compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'commons-io:commons-io:2.6'
I found a post from somebody else that had the same problem. I don't know why it works and neither did the original person with the problem. I think this is either caused by buggy Google Play software and/or a complete lack of documentation.
Usually this problem are about configuration permision or uses feature
In this case looks the problem is like this:
<uses-feature android:name="android.hardware.bluetooth" />
<uses-feature android:name="android.hardware.camera" />
Check the users feature you need to change in the DOCUMENTATION

How to fix "Activity class does not exist" error in android? [duplicate]

This question already has answers here:
Package rename and error "Activity class does not exist"
(11 answers)
Closed 7 years ago.
I was trying to rename my first android project to something else following the suggestion by Ben in this post. However, even after following the suggestions here to clean up, I get an error when the app is started on my phone (build went fine):
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.impyiablue.stoxx/com.example.alexander.myapplication.MainActivity }
Error type 3
Error: Activity class
The content of my gradle.build file is as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.impyiablue.stoxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.+'
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
My Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.impyiablue.stoxx" >
<uses-permission android:name="android.permission.INTERNET" />
<application>
android:allowBackup="true"
android:icon="#mipmap/stoxx"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.Light" />
<activity
android:name="com.impyiablue.stoxx.MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.impyiablue.stoxx.NewEntryActivity"
android:label="#string/menu_add"
android:theme="#style/AppTheme.NoActionBar"
/>
</application>
</manifest>
What else do I have to modify so AndroidStudio 'sees' the new name? Or whatever is wrong?
edit application tag as show in below:
<application
android:allowBackup="true"
android:icon="#mipmap/stoxx"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.Light" >
The activity tags are outside the application tag because you closed the application tag.
<application> " The '>' over here should not be there"
android:allowBackup="true"
android:icon="#mipmap/stoxx"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.Light" /> " The '/' over here closes the application tag."
Your activity tags need to be enclosed within the application tag.
Your application tag should like this :
<application
android:allowBackup="true"
android:icon="#mipmap/stoxx"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.Light" >
<activity
android:name="com.impyiablue.stoxx.MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.impyiablue.stoxx.NewEntryActivity"
android:label="#string/menu_add"
android:theme="#style/AppTheme.NoActionBar"
/>
</application>

Application not Installed in Android

I developed an application, this application has 2 versions. when Install new version Application on old version.it shows Application Not Installed.
my manifest :
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/smsbox_2_logo"
android:label="#string/app_name"
android:largeHeap="true"
android:screenOrientation="portrait"
android:theme="#style/AppTheme">
<activity
android:name=".activities.Main_Page"
android:label="#string/app_name"
android:screenOrientation="portrait"></activity>
<activity
android:name=".activities.addSMS_Page"
android:label="#string/title_activity_new_sms"
android:screenOrientation="portrait" />
<activity
android:name=".activities.ShowSMS_Page"
android:label="#string/title_activity_show_sms__page"
android:screenOrientation="portrait" />
<activity
android:name=".activities.MySMS_Page"
android:label="#string/title_activity_my_sms__page"
android:screenOrientation="portrait" />
<activity
android:name=".activities.Fav_Page"
android:label="#string/title_activity_fav__page"
android:screenOrientation="portrait" />
<activity
android:name=".activities.login_Page"
android:label="#string/title_activity_login__page"
android:screenOrientation="portrait"></activity>
<activity
android:name=".activities.register_Page"
android:label="#string/title_activity_register__page"></activity>
<activity
android:name=".activities.category_Page"
android:label="#string/title_activity_register__page"></activity>
<activity
android:name=".activities.category_select_Page"
android:label="#string/title_activity_register__page"></activity>
<activity
android:name=".activities.about_Page"
android:label="#string/title_activity_about__page"></activity>
<activity
android:name=".activities.setting_Page"
android:label="#string/title_activity_setting__page"></activity>
<activity
android:name="com.tellfa.smsbox.activities.splash_Page"
android:label="#string/title_activity_splash__page">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.connectus_Page"
android:label="#string/title_activity_connectus__page"></activity>
</application>
</manifest>
Build.Gradle code :
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.tellfa.smsbox"
minSdkVersion 14
targetSdkVersion 22
versionCode 10
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
how to fix it ?
Just uninstall old Application and then install new version
you probably used a different keystore file, you need to uninstall the app and re-install it
Set minimum and target Sdk versions in mainfest
the keystore should be same for two versions. in this case you have to un-install previous version and reinstall new version will fix the issue. or use the same keystore

Android app showing incompatible after publishing

I have just tried to publish my first app but when it finally went through it was shown as being incompatible to multiple devices, I have been searching and every fix that I have come across has done nothing for me. Any suggestions?
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.customledsupply.ledaudit" >
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/cls"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainPage"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".OldLocation"
android:label="#string/title_activity_old_location" >
</activity>
<activity
android:name=".NewLocation"
android:label="#string/title_activity_new_location" >
</activity>
<activity
android:name=".RoomDescription"
android:label="#string/title_activity_room_description" >
</activity>
<activity
android:name=".FixtureDescription"
android:label="#string/title_activity_fixture_description" >
</activity>
<activity
android:name=".RoomList"
android:label="#string/title_activity_room_list" >
</activity>
<activity
android:name=".Summary"
android:label="#string/title_activity_summary" >
</activity>
</application>
</manifest>
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.customledsupply.ledaudit"
minSdkVersion 19
targetSdkVersion 22
versionCode 2
versionName "2.0"
}
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "CLS"
keyAlias "Custom LED Supply"
keyPassword "CLS"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'io.realm:realm-android:0.82.0'
}
Most probably, the potential cause is the following:
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
If any device doesn't have this feature, it wont even show it on the play store for them and will be in your list of incompatible devices. If you want to make it optional, use android:required="false" instead. By doing thing, you might be able to get around the issue.
Otherwise if you give examples of the incompatible devices, we might be able to narrow down the issue more. Hope it helps.
In your AppManifest.xml, you added a feature that is not be supported by all devices which is android:name="android.hardware.camera2". It only supports API 21+. However, you can set the required attribute to false, but that will cause issues for your app.
Reference Link: https://developer.android.com/reference/android/hardware/camera2/package-summary.html

Categories

Resources