After deployment of an app to Google Play Beta I see next issue in Crashlytics (6 - 7 users are affected)
Fatal Exception: java.lang.IllegalStateException: UiAutomation not connected!
at android.app.UiAutomation.throwIfNotConnectedLocked(UiAutomation.java:971)
at android.app.UiAutomation.disconnect(UiAutomation.java:237)
at android.app.Instrumentation.finish(Instrumentation.java:222)
at android.support.test.runner.MonitoringInstrumentation.finish(MonitoringInstrumentation.java:351)
at android.support.test.runner.AndroidJUnitRunner.finish(AndroidJUnitRunner.java:405)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:394)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1960)
It seems that it's google test devices.
Any ideas about fix?
It seems like nothing to worry about (don't rely on accepted answer and don't remove your tests) because crashes have been reported on creating pre-launch report for google play store where some UI automation tests were executed. If you track devices on which this error has occurred then you'll see that all paths lead to pre-launch report.
You can find out more about pre-launch report here
It seems that this crash is related to UI testing in your app. If you don't have any UI testing and there are only default settings which added automatically during creating the project, you should remove from your build.gradle the line testInstrumentationRunner in defaultConfig
defaultConfig {
....
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
and androidTestCompile, testCompile in dependencies
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
...
One thing is sure: you have an issue on UI. In most cases this occurs when you show a progress dialog that keeps being displayed for too much time. In this case the Google crawler goes in timeout and raises an exception.
My advice is: be sure to not block UI with infinite dialogs.
The funny thing is that I get this crash while my app is being tested by google before publishing. I really don't know what google team is doing.
Related
I've an Android app using retrofit 2 and okhttp for its json requests. everything was going fine until android studio(AS) oferred me the update from 3.9.6 to 4.1
The update is done easily inside the AS and it also updates the gradle plugin.
Once the update was finished I rebuild and compiled a new aab, then i notice the new file generated was 100kb smaller than the previous one (altough no code or assets changes were made, only the IDE version updated)... then i release on google play and download it in my test device (real phone). It didn't work. The app opens but it is not able to perform any okhttp request
I tried to run inside AS emulator -> it worked fine.
I tried to run in the emulator with minifyEnabled true shrinkResources true -> it worked fine
so i added to the code several debug calls in order to let me know exaclty until what line the app was working.... and i got.
try {
okHttpClient.newCall(new Request.Builder().get().url("https://www.google.com").build()).execute();
return true;
} catch (Exception e) {
return false;
}
this is a little snippet i use to test if user has internet connection.
No exception is thrown, no value is returned, the call simple dive into the okhttp api and never come back...
So i want to let clear: no code was changed, no api was updated, no r8 rules was changed
the only thing changed was the AS updated from 3.9.6 to 4.1 and some mandatory gradle plugin updated as well
after that the signed aab built got 100kb smaller and this very weird behavior started happening...
I've already tried EVERYTHING i can, but still no idea how to solve. does anyone ever face a similar problem or have idea what to do?
there are my imports
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation('com.facebook.android:facebook-login:5.13.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
//retrofit
implementation('com.squareup.retrofit2:retrofit:2.9.0') {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
implementation "com.squareup.okhttp3:okhttp:4.10.0-RC1"
implementation 'com.squareup.okio:okio:2.9.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation('com.squareup.retrofit2:converter-gson:2.9.0') {
exclude group: "com.google.code.gson", module: "gson"
}
I've already tried EVERYTHING i can, but still no idea how to solve. does anyone ever face a similar problem or have idea what to do?
Yes, everyone faces these problems. It's part of the learning process of being a developer. Stop focusing on this particular problem with this library for a minute and ask why you are stuck and how to get unstuck. If you reported this to a library maintainer this is what they would need to do, which is why they would ask for a clean reproduction.
Firstly read http://sscce.org/ and understand what it means and why the above question isn't getting answers. It's not a clean reproduction, it's a few random lines of code.
Then ask a a colleague to help you use a debugger, where is it stuck, what are the threads doing or waiting on.
Use the features of the library e.g. add an OkHttp Event Listener https://square.github.io/okhttp/events/.
Going back the SSCCE example, make a small example project reproducing the issue and post it to a temporary github project, then report that as a bug to OkHttp project. They can just check out the project and run it to reproduce then.
For me, I was trying to fetch data using a retrofit. Getting 400 on release build. My model was like the following:
data class ContentIdAddRQ(
#SerializedName("contentId")
val contentId: String? = null,
#SerializedName("contentType")
val contentType: String? = "VOD",
)
Then I tried adding #Keep annotation to my Model file as shown below:
#Keep
data class ContentIdAddRQ(
#SerializedName("contentId")
val contentId: String? = null,
#SerializedName("contentType")
val contentType: String? = "VOD",
)
My Android app dumps files into Gdrive. It's using Oauth2.0 authentication and I've done the needful at console.developers.google.com. The problem I'm facing is that the app works fine on my Marshmallow phone but cannot get past the Google login on my JellyBean or lower. On these, the app gets stuck at the "Choose account for" window.
Studio's Android monitor returns the following:
GoogleApiClient connection failed: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{419cbb80 ...
Keeping in mind that the app does work on the Marshmallow phone, my suspicion is that the issue is related to one of the "versions" in the app's build.grade file, an excerpt of which is below.
compileSdkVersion 23
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "rudy.android.stgpro"
minSdkVersion 9
targetSdkVersion 18
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.rudykeystore
}
debug {
signingConfig signingConfigs.rudykeystore
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services-drive:8.4.0'
}
Or, maybe, Oauth2.0 does not work with earlier Android versions.
I also notice that the size of the app loaded into Marshmallow is about 40% the size of that loaded into the other two phones.
Google's Drive app works fine on all phones.
I've googled around for hours now and am, pretty much, stuck. Any suggestions?
After much "blood, sweat and tears", I've discovered that the problem lay in a single line in the AndroidManifest.xml file ...
android:launchMode="singleInstance"
I have no clue why this line affects phones running JellyBean and lower but not Marshmallow (not sure about Kitkat & Lollipop). And, just to be clear, the line literally toggles the problem with its presence/absence (with zero other changes).
I zeroed in on the problem using Drives's Quickstart as a base (its connection worked with all my test phones), then gradually modifying its code by adding/removing from my app's code (took me a couple of days).
Anyway, thank goodness for these working samples.
At the moment I'm trying to implement Google Play Games Services Sign In to my android app. I already had a lot of trouble so far, but it seems I', coming closer to it actually working.
The Problem:
When i press login, the sign-in function returns the following error:
02-18 12:31:51.122 5524-21263/? W/Auth: [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
02-18 12:31:51.128 5206-5723/? E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
02-18 12:31:51.144 5206-32272/? W/GamesServiceBroker: Client connected with SDK 8487000, Services 10298230, and Games 39080030
What I've done so far:
I tried to follow the documentation as good as possible, but either I'm doing something wrong or it is kind of a mess. I guess somewhere, i made a mistake.
My Manifest file includes this:
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
I have a games-ids.xml file including the App-ID and ID's for highscores and achievements.
My gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.duke.privatpc.quiztest"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':BaseGameUtils')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
This includes the BaseGameUtils downloaded from the Getting Started Page.
I set up the Game at the Google Play Developer Console and added the created App-ID.
I always used my own keystore for creating the apk and also for creating the App-ID. Is there any need to use the debug.keystore at any point?
As you can see here, the SHA1 are identical and the correct APP-ID is shown.
APK SHA1
Developer Console SHA1
I honestly have no idea what I'm doing wrong. I also activated testing and entered my email adress.
Also, absolutely nothing happens when clicking my sign-in button. There is no Google Overlay popping up, I'm not sure if this is already weird?
I hope someone can help me, as I didn't find any questions that could help me and it's getting a bit frustrating for an amateur-programmer like me.
Thanks!
Where did you create the OAuth 2.0 client for your app? From your screenshot it seems that this is the entry in the Google API console.
Did you also create an entry in the Game services section in the Google Play Developer console (see step 2 in the Google documentation)? I had big problems with my current game, because I created the OAuth 2.0 client manually in the Google API console and not in the Google Play Developer console and the OAuth 2.0 IDs in both consoles didn't match. According to a video from Google Developers OAuth 2.0 clients should only be created in the Google Play Developer console. I wrote more about what I did wrong in this post.
I have use Firebase Cloud Messaging(FCM) API for the push notification in Android. When I implemented that time perfect work but now it's can not find the Service of google play.
the error is:
FirebaseInstanceId: background sync failed: SERVICE_NOT_AVAILABLE,
Please help me how to resolve. I Have use below dependency in gradle file.
dependencies {
compile files('libs/ksoap2-android-assembly-3.4.0-jar.jar')
compile 'com.android.support:appcompat-v7:23.0.0'
compile files('libs/gson-2.2.4.jar')
compile files('libs/activation.jar')
compile files('libs/mail.jar')
compile files('libs/additionnal.jar')
compile 'com.android.support:multidex:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.14.0'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile('com.google.android.gms:play-services:9.0.2') {
exclude group: "play-services-wallet"
exclude module: "play-services-wallet"
exclude group: "play-services-ads"
exclude module: "play-services-ads"
}
}
Thanks for taking the time to read this.
Verify internet connectivity
Verify if the Android SDK tools(Tools -> Android -> SDK manager -> SDK tools tab) has 'Google Play services' latest version and if not install the package.
Then if you are using emulator, please stop the emulator and start it again.It works
You can check
Check your internet connection with no proxy and open internet connect
Replace your google-service.json with new one you can get this in firebaseconsol
Please check your device has google play service in it and it working or not , firebase not work without google play service
Check -FireBaseInstanceId service does not get registered
After long struggle i found the answer, if google play service is not running then FirebaseInstanceId background sync failed - SERVICE_NOT_AVAILABLE log print, so you can check your google play service is running properly or not ?
May be this information is helpful to you !
the service needs to be bound in the Manifest.xml
<!-- Firebase InstanceId Service -->
<service
android:name="eu.acme.service.FireBaseInstanceIdService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
then one can access one single exposed method (the other names are obfuscated = not reliable):
package eu.acme.service;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
public class FireBaseInstanceIdService extends FirebaseInstanceIdService {
#Override
#android.support.annotation.WorkerThread
public void onTokenRefresh() {
/* obtain the current InstanceId token: */
String token = FirebaseInstanceId.getInstance().getToken();
}
}
one could only work around it, by not provoking it, eg. by not adding any AuthState Listener while knowing that there is no active network present, as explained here - as it seems, one otherwise cannot catch the exception thrown from within the library - which can be ignored, since it merely just complains, that there is no network connectivity.
com.google.android.gms.iid and com.google.firebase.iid are about the same.
I had to disbale my VPN - hope this helps someone !
I just had this problem. In my case, only worked when I stopped the emulator, closed it, and opened again. I didn't make any other changes.
Easiest solution is to delete the bin and obj folders under the .Droid directory.
In this way you have a clean start every time.
In my case - I rebooted my PC and it worked.
Im not an expert, so I might have covered one of the mentioned tipps by my approach
Connect your mobile with different wifi connection with different service provider. It seems weird but you can try it!
In my case, I just removed instant run from Android Studio preferences
Me too had the same issue, resolved by just Clean Project option under build. Hope it might help anyone here.
You need to update your play services and make sure your internet connectivity is good.
In my case
I have been Added google-services.json file in Project root, I moved it to app folder and problem has been fixed.
MyProjectRootDir/google-services.json
move to -->
MyProjectRootDir/app/google-services.json
I'm using leakcanery for a while now and it works fine! The thing is after testing one of my app on wide range of device some leaks showed up that i never saw them before so i decided to enable leakcanery in production version as well or trace of leaks to my server. 3 questions
1 - Will performance suffer?! Sometimes leakcanery causes some lags in debug mode, so if i enable in production version. does the same lags happen?
2 - I read the documentation on how to send heapfile to server but is there any way to send trace instead, like the once leakcanery normally shows. I really don't want to analyse heapfile when i got it. so how can i parse this file before sending it to make something meaningful out of it?
3- I may be the dumest question but what should i do to enable leakcanery in production version? Is is enabled by default or should i config it some how?
Part of the answer:
debugCompile is only for debug build and releaseCompile for production build.
dependencies {
// Real LeakCanary for debug builds only: notifications, analysis, etc
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
// No-Op version of LeakCanary for release builds: no notifications, no analysis, nothing
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}