I crated android applciation uses gmaps, so play lib version is:
dependencies {
compile 'com.google.android.gms:play-services:4.0.30'
}
And following code works perfect on most of my devices:
markerOptions.position(latLng)
.anchor(0.5f, 0.5f)
.rotation(90)
But on one I have exception (Andrid 4.0.3) saing:
java.lang.NoSuchMethodError: com.google.android.gms.maps.model.MarkerOptions.rotation
And when I check Goolge Play Services lib accroding to this http://developer.android.com/google/play-services/setup.html
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (ConnectionResult.SUCCESS == resultCode) {
Log.i("GSR", "GOOGLE PLAY SERVICES VERSION IS AVAILABLE");
return true;
}
I do see SUCCESS message in logs.
So what we have: the lib version is obviusly not up to date, but it could not identify this.
Solved, I don't know how, but old version of google play services lib was packing in apk, what I did is start SDK manager, removed play services lib and goolge repository packages, and install them again. After that apk begin to work.
Related
I'm trying to add Google Play Services on my Unity Android project.
I've got already implement google play services plugin to my project. Filling the all crediantials. I've got 2 different internal test accounts on developer console.
Here is my question:
Account A: SignInStatus Success and not showing welcome pop-up
message.
Account B: SignInStatus Canceled and not sign in.
Is it because internal test or something?
unity version: 2019.4.16f1
gpgs plugin verison: 0.11.01
Here is my code:
referanced: https://github.com/playgameservices/play-games-plugin-for-unity
using GooglePlayGames;
private bool Authenticated;
public void Start() {
PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);
}
internal void ProcessAuthentication(SignInStatus status) {
if (status == SignInStatus.Success) {
// Continue with Play Games Services
Authenticated = true;
} else {
// Disable your integration with Play Games Services or show a login button
// to ask users to sign-in. Clicking it should call
// PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication).
Authenticated = false;
}
}
There is nothing wrong with your code.
I just created a new project, got a new SHA-1, added my account to the new google play console and verified that everything was tested successfully.
In doing so, we found the following problems:
If you are using the 11.01 version, please check if there is a problem by following the procedure below.
Follow the steps below to check.
(Assets → External Dependency Manager → Android Resolver → Force Resolve)
Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11: Repo path 'Packages/com.google.play.games/Editor/m2repository' does not exist.
If the above error occurs, you can solve it by choosing one of two solutions.
First, see comments by #greg-hanes here.
The specific method is to create a GooglePlayGamesPluginDependencies.xml file inside the Assets/GooglePlayGames/com.google.play.games/Editor/m2repository folder and paste the following contents.
<?xml version="1.0" encoding="UTF-8" ?>
<dependencies>
<!-- Internal library dependency generated at build time.
It also defines the transitive dependencies on play-services
-->
<androidPackages>
<androidPackage spec="com.google.games:gpgs-plugin-support:0.11.01">
<repositories>
<repository>Assets/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>
</repositories>
</androidPackage>
</androidPackages>
</dependencies>
And then Force Resolve again.
(Gradle failed to fetch dependencies on the way. If you get an error, make sure your JDK path is set correctly.)
Second, downgrade the version to version 10.14.
Here is my code that I wrote to run only once at runtime. It works successfully when I run it.
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
public static class Login
{
[RuntimeInitializeOnLoadMethod]
public static void SignIn()
{
PlayGamesPlatform.Instance.Authenticate(success =>
{
Debug.Log(success ? "Success Login" : "Failed Login");
});
}
}
You can check the logs on Android by installing the Android Logcat package.
I hate the 11.01 version so I'm using the 10.14 version :)
Hope your problem is solved!
Some context: Most of us may have faced this ResourceNotFoundException when we migrated to Android app bundle release method. It is evident that the issue is because of Side-loading the app. Reference here.
Google recently announced solution to this problem. Using play core library we can identify whether the app is side-loaded or not (Identifies the missing split apks). If the app is side-loaded it shows "Installation failed" popup and redirects to play store, where user can properly install the app via the Google Play store.
Problem: Everything works fine until the installation of missing split apks from play store. Now when I relaunch the app, it immediately crashes with an error saying.
Default FirebaseApp is not initialised in this process
Note: Directly downloading the app from play store works perfectly fine without any crash. The crash happens only when the app re-downloads because of side loading issue.
Code:
Project's build.gradle:
buildscript {
dependencies {
classpath 'com.android.tools.build:bundletool:0.9.0'
}
}
App module's build.gradle:
implementation 'com.google.android.play:core:1.6.1'
Class that extends Application:
public void onCreate() {
if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
// Skip app initialization.
return;
}
super.onCreate();
.....
}
Any help would be really great.
I have solved this issue with the latest version of Play core library:
App module's build.gradle:
implementation "com.google.android.play:core:1.7.2"
Other implementation remains same.
A class that extends Application:
public void onCreate() {
if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
// Skip app initialization.
return;
}
super.onCreate();
.....
}
How to test:
A better way to test it properly is to release the app bundle with these above fixes in play store internal test channel (Add yourself as a tester).
Simulate installing invalid apks - Use bundletool to get .apks file out of bundle, extract it and install base_master.apk using adb command
adb install base_master.apk.
Launch the app, you should see "Installation failed" dialog and it redirects to Play store, clicking on Update, play store will install the missing apks.
Launching the app should work properly by now.
Hope this helps
I have a paid app on the Google Play Store and have been using the LVL library for the past two years. In the past, I tested my app on multiple devices including Android V2.3.5 (Gingerbread), V4.4 (KitKat) and V5.1 (Lollipop), everything worked fine connecting to the google license server.
Recently, I retested on all my Android devices and found the license verification library runs perfectly on Android V4.4 and V5.1 but I can't make a successful connection from the V2.3.5 (Gingerbread) device (Motorola Electrify).
I get a responseCode = 0x101 (ERROR_CONTACTING_SERVER) in the verify() callback on the older v2.3.5 device - appears to time out connecting. I tried several accounts and both fail in the same way on the older Gingerbread platforms.
I also tested earlier APK files that used to work and they fail now also.
Did support for older Android OS versions get dropped over the past year?
Is there something I need to change to support the older devices?
Thanks in advance,
Phil
SDK LVL code
class LicenseValidator {
...
public void verify(PublicKey publicKey, int responseCode, String signedData, String signature) {
String userId = null;
// Skip signature check for unsuccessful requests
ResponseData data = null;
if (responseCode == LICENSED || responseCode == NOT_LICENSED ||
responseCode == LICENSED_OLD_KEY) {
// Verify signature.
...
switch (responseCode) {
case LICENSED:
case LICENSED_OLD_KEY:
int limiterResponse = mDeviceLimiter.isDeviceAllowed(userId);
handleResponse(limiterResponse, data);
break;
case NOT_LICENSED:
handleResponse(Policy.NOT_LICENSED, data);
break;
case ERROR_CONTACTING_SERVER:
Log.w(TAG, "Error contacting licensing server.");
handleResponse(Policy.RETRY, data);
break;
case ERROR_SERVER_FAILURE:
Log.w(TAG, "An error has occurred on the licensing server.");
handleResponse(Policy.RETRY, data);
break;
Okay, I figured it out tonight. Post Google Play Services 10.0.1, support for Gingerbread V2.3 is depreciated.
https://9to5google.com/2016/11/21/google-play-services-gingerbread-support-end/
https://developers.google.com/android/guides/releases
"Highlights from the Google Play services 10.0 release.
Google Play services updated to 10.0.1
This release fixes a missing minSdkVersion value in play-services-location.aar that caused unintended WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, and READ_PHONE_STATE permissions to be merged into app manifests.
Android version 2.3.x (Gingerbread) Deprecation
Google Play services 10.0.x is the final release that includes full support for Android version 2.3.x (Gingerbread). Apps developed using future SDK releases after 10.0.x will not be able to connect to Google Play services on Android Gingerbread devices. To learn more about your options, including building multiple APKs to extend your app's support for Android Gingerbread, see the Android Developers Blog."
Phil
I'm trying to use Google cloud messaging for an android app (Target name: Google APIs, platform: 4.3, API level: 18. I implemented my GCM client by following the isntructions here: http://developer.android.com/google/gcm/client.html, and setup play services by following the steps here:
http://developer.android.com/google/play-services/setup.html#Setup, but still get the above error Most of the solutions I've found on stack overflow redirect to the above two links, or suggest that we change the dependencies {} in the gradle settings, but I'm using eclipse and don't have gradle setup.
Update: Sorry yes I'm using the emulator and not a device
Any ideas?Thanks!
If you need to provide an option for the user to update the google services you can do this:
switch (isGooglePlayServicesAvailable(this)) {
case 2: //out date
try {
GooglePlayServicesUtil.getErrorDialog(2, this, 0).show();
} catch (Exception e) {
e.printStackTrace();
}
break;
}
This will prompt an update dialog for the user to update play services
The final solution was creating a new emulator under Android 4.4.2, with the build target of the project set to Google APIs (x86 System Image). Thanks to Pedro Oliveira!
I am currently working on Gcm for sending notifications to android device.
I installed google play services Rev.15 from the SDK manager ->extras and imported and referenced those in my android app.
My android project API level is 17.
In the manifest file i have
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>
This is the manifest of google-play-services_lib
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms"
android:versionCode="4242030"
android:versionName="4.2.42 (1018832-030)" >
<uses-sdk android:minSdkVersion="9"/>
</manifest>
I use AVD_for_Nexus_One_by_Google 4.2.2 Api level-17 Target as Google APIs(Google Inc.)
This is the code in my android app to check the play services
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
I get the following error.
Update Google Play services. This app won't run unless you update Google Play Service.
And in the log i find that, google play services is out of date. Requires 4242000 but found 3136130.
Please help me with this. Thanks!
use a real device to test Play Services related stuff.
Emulators are not guaranteed to have Google Play Services out of the box.