Invalid package file after the update of Google Drive API - android

In our app we use successfully the Google Drive API:
/libs/google-http-client-1.12.0-beta.jar
/libs/jsr305-1.3.9.jar
/libs/google-http-client-gson-1.12.0-beta.jar
/libs/google-api-client-1.12.0-beta.jar
/libs/google-http-client-jackson2-1.12.0-beta.jar
/libs/google-oauth-client-1.12.0-beta.jar
/libs/google-http-client-android-1.12.0-beta.jar
/libs/google-api-client-android-1.12.0-beta.jar
/.google_apis/drive-v2r61lv1.12.0-beta/drive/google-api-services-drive-v2-rev61-1.12.0-beta.jar
/.google_apis/drive-v2r61lv1.12.0-beta/drive/libs/guava-jdk5-13.0.jar
/.google_apis/drive-v2r61lv1.12.0-beta/drive/libs/google-http-client-jackson-1.12.0-beta.jar
/.google_apis/drive-v2r61lv1.12.0-beta/drive/libs/jackson-core-2.0.5.jar
/.google_apis/drive-v2r61lv1.12.0-beta/drive/libs/jackson-core-asl-1.9.9.jar
/.google_apis/drive-v2r61lv1.12.0-beta/drive/libs/gson-2.1.jar
Four days ago I found the Google API with UPDATE AVAILABLE text then I updated
After the update we have now the following libs:
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/jsr305-1.3.9.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-http-client-android-1.13.1-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-oauth-client-1.13.1-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-http-client-jackson2-1.13.1-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-http-client-jackson-1.13.1-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-http-client-gson-1.13.1-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/google-api-services-drive-v2-rev69-1.13.2-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-http-client-protobuf-1.13.1-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/guava-jdk5-13.0.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/jackson-core-2.0.5.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/protobuf-java-2.4.1.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-http-client-1.13.1-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/jackson-core-asl-1.9.9.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-api-client-1.13.2-beta.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/gson-2.1.jar
/.google_apis/drive-v2r69lv1.13.2-beta/drive/libs/google-api-client-android-1.13.2-beta.jar
After the update we just proceeded with the apk publishing.
About the 2% of our users are reporting INVALID PACKAGE ERROR during the installation.
We tried to send the apk with old Google Drive API to this users and it installed fine.
Any suggestion how to understand if the problem is related our app apk or to Google Drive API ?

You might have conflicting libraries. I have to do a similar implementation on the .NET side and I had to download the Google source projects and recompile them instead of using binaries.
I have an example here
http://www.alexroque.com/?p=307
although this is an example of integration with Google drive API.

Related

Your app is using a version of libjpeg-turbo containing a security vulnerability

Google play store gives me this error when I am trying to send my application for review.
Your app is using a version of libjpeg-turbo containing a security
vulnerability. Please see this Google Help Center article for details,
including the deadline for fixing the vulnerability.
Consulting Google Help Center here: https://support.google.com/faqs/answer/7008337 says I should be using a libjpeg-turbo v1.4.2 or higher.
My problem is that I am already using version 2.1.4.
This is a copy paste from my CMakeList.txt
include(FetchContent)
FetchContent_Declare(turbojpeggit
GIT_REPOSITORY https://github.com/libjpeg-turbo/libjpeg-turbo
GIT_TAG 2.1.4
)
FetchContent_GetProperties(turbojpeggit)
if(NOT turbojpeggit_POPULATED)
message("libjpeg-turbo not populated... downloading")
FetchContent_Populate(turbojpeggit)
add_subdirectory(${turbojpeggit_SOURCE_DIR} ${turbojpeggit_BINARY_DIR})
include_directories(${turbojpeggit_SOURCE_DIR})
include_directories(${turbojpeggit_BINARY_DIR})
message("libjpeg-turbo downloaded")
else()
message("libjpeg-turbo already populated")
endif()
So I guess this is a false positive but I am unable to publish my application because of this.
Please help me.
I tried contacting Google but got no answer yet.
However, I managed to get the application published by linking against the static version of the libjpeg-turbo library.
Note there is a ENABLE_SHARED option in libjpeg-turbo that should be set to OFF.
To verify you aren't using the shared version, you can unarchive the apk and check you don't have any of these files:
lib/arm64-v8a/libturbojpeg.so
lib/armeabi-v7a/libturbojpeg.so
lib/x86/libturbojpeg.so
lib/x86_64/libturbojpeg.so

Unable to create preview of the app actions used in the app in google assistant

I have added the shortcuts.xml in res/xml and also added the
<meta-data
android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
in the AndroidManifest.xml and also uploaded the signed bundle file in the play console internal testing.
But I'm getting the below error while creating the preview using the google assistant app actions test tool in android studio
Google Assistant plugin v2.3.0
Preview Creation Error
Status Code: 400
Message: Precondition check failed.
- Please sign in to Play Console (https://play.google.com/apps/publish) and check if you have accepted the latest Terms of Service (ToS), and the Gmail/G-Suite account has the authorization to modify the app with package name 'uninitialized.application.id'.
The part of the error message that reads
modify the app with package name 'uninitialized.application.id'
seems particularly strange. There are a few things I would make sure about:
Make sure your app/build.gradle has the correct applicationId in the defaultConfig section and that you use this Id elsewhere.
Make sure that was the version that you uploaded.
Ensure that the account that you used for the play store is the same account that you're using to for the test tool.
This issue suggests that a default applicationId may have been assigned and set in the merged manifest, and that you can just rebuild the entire project once you have it correctly set in app/build.gradle

Why do I get com.google.android.gms.common.api.ApiException: 10:?

private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class); //exception is here
// Signed in successfully, show authenticated UI.
System.out.println("google token ---> " + account.getIdToken());
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
// Please refer to the GoogleSignInStatusCodes class reference for more information about this error.
e.printStackTrace();
}
}
Quoting the documentation:
Certain Google Play services (such as Google Sign-in and App Invites)
require you to provide the SHA-1 of your signing certificate so we can
create an OAuth2 client and API key for your app.
If you are using Firebase and try on the debug app :
1. First, get your SHA-1 debug key :
Click on Gradle (From Right Side Panel, you will see Gradle Bar)
Click on Tasks
Click on Android
Double Click on signingReport (You will get SHA-1 and MD5)
2. Add your key to your Firebase project :
Go to Project settings -> SHA certificate fingerprints -> Add SHA-1 key of debug app.
Then you can update your google-services.json file in your Android project.
Its works for me.
This status code means that you are providing unknown server client id.
In https://console.developers.google.com/apis/credentials in your project you might need to generate: OAuth client ID -> Web Application and use this web application client id here:
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(webApplicationClientId)
.requestEmail()
.build()
I have solved this problem using these steps:
1). Goto https://console.developers.google.com/ and delete (Android Client) if it is created.
2). Click on Create Credential and click on OAuthClientID and select android
3). copy and paste your SHA 1 fingerprint
4). type your package name then saved
5). Goto console.firebase.com
6). download google-service.json move it into your project into app directory
7). Open google-service.json and find out client id type 3 and use it as default_web_client_id
8). Run your App
I have this thing in 2-3% of the occasions in production and it works seamlessly for everyone else.
Given the sheer amount of problems and differing answers this is causing, it's fair to say that this is a problem on behalf of firebase. They've implemented a catch-all error routine that is just bad api design. The api must point to the problem where it fails.
A long term solution is to convince firebase that this is bad-api design and they need to do better.
We're strong together.
Please write a support ticket to firebase roughly with this:
Hey Firebase Support,
i have a com.google.android.gms.common.api.ApiException: 10 in my app.
The problem for me - and for a lot of people all over the forums - is
that your api seems to have a catch-all error routine that roughly
speaking is saying "something went wrong, please fix it".
You could release your support team and a lot of people from headache
if you would fix this.
The API should be able to figure what's wrong and give a better error
message from the context where it occurs.
It's really a burden and I think that since firebase has a
quasi-monopoly on these matter on Android it's your obligation to do
better.
While this is obviously not your fault, I'd like to encourage you to
escalate this problem.
It's fundamentally bad api design and harms an otherwise great
product.
Thanks anyway.
My problem was trying to use Google Sign-In yet I had accidentally enter the wrong SHA1 in Firebase. Try running Gradle > Your app name > Tasks > android > signingReport, get your SHA1 key and compare it with the one on Firebase. If they are different, change the Firebase SHA1 key to match the one you got from the signingReport. Don't forget to also download the google-services.json afterwards.
The ApiException Error Code 10 is a developer error. You get this error when your firebase app is not well configured. One sure case is when you do not supply the SHA1 fingerprint for your android app when you want to use Firebase authentication with Google Signin. (It is a requirement for Google Signin).
So supply the SHA1 fingerprint, download the google-services.json configuration file to your app folder and build. You should be good to go.
Google sign-in is automatically configured on your connected iOS and web apps. To set up Google sign-in for your Android apps, you need to add the SHA1 fingerprint for each app on your Project Settings.
Check this out Common Status Error Codes
In my case the problem was with the SHA1 and google-services.json file
i solved the problem follow this steps:
1.- Open https://console.cloud.google.com/apis/credentials and delete file at OAuth 2.0 Client IDs
2.- Open https://console.firebase.google.com/ clic gear icon -> Proyect Settings -> Select your Android App -> add fingerprint -> save -> and download google-services.json file
3.- Open your android proyect and replace de google-services.json file -> clic Sync Proyect with Gradle Files
4.- The new default_web_client_id at values works fine for me and solved the problem
that is because you are using the wrong default_client_token_id.
to solve this go to the JSON file downloaded from firebase and open it:
your client_id is located right after the
"certificate_hash":xxxxxxzxzxzzzxzxzxzxzxzx....
good luck :) and I hope it helped.
Don`t forget to add
<application
...
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
...
</application>
under your manifest file application tag.
In my case problem was because of absent this lines.
ApiException 10 is a DEVELOPER_ERROR, which means something's wrong with your app configuration.
This answer worked for me, but then I realized our app authenticates with a backend server. So, if your app authenticates with a backend server, you only need to use the web application client ID. But you still need to create client ID of Android type or you're going to get ApiException 12500 . You can read more about it from the documentation. (note that the link has authuser=0)
If you remove this line it will work:
System.out.println("google token ---> " + account.getIdToken());
This is because you don't have the request to the idToken:
.requestIdToken(getString(R.string.google_app_id))
where the app_id will have the value of "OAuth client ID -> Web Application"
When you are doing setup of google login, it normally take Signed keystore hash key. So try with signed APK then it will work. For debugging try to add your debug SHA key on google console.
I guess the question is answered. But for me it was a little different. So
if some googlers come along this and may have the same problem as I had:
Special Case
multiple firebase projects
client ids whitelisted
installed app through app sharing can't sign up with google
In case anybody is using multiple firebase projects for one application (i.e. for different flavors) and has whitelisted the "external" client ID in Google-Authentication in one project.
Then the solution is, to generate new credentials in the Google APIs console of the "master" / whitelisted project with the sha-1 (found in app sharing) of the other project.
Add new credentials to API Console
Go to Google APIs of whitelisted project
Create new OAuth Client ID
Add everything needed, also package name of other project
Paste the SHA-1 hash from App Sharing of other project
Done
Sorry for my bad english. It's not my mother tongue.
This Error because of Wrong Client Id
GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
You must pass your server's client ID to the requestIdToken method.
client Id can be found eaisly in google-services.json file
{
"client_id": "",
"client_type": 3
}
No need to go to Credentials page in the GCP Console.
Please to follow instructions from
https://firebase.google.com/docs/auth/android/google-signin
If you came here because of an error with the Google Login iOS & Android Unity library, this is what helped for me.
I changed the Google project and kept getting ApiException: 10. I later found out that it was because you need to use a web client, not an Android one.
If you want to check if you have a web client or an Android one, open the client_secret_(some text).apps.googleusercontent.com.json file - if it starts with {"web" it's a web client.
Step by step instructions for replacing the client:
Remove the client_secret_(some text).apps.googleusercontent.com.json file from your Unity project. If you have a plist file (for iOS) too, don't remove it.
Go here, click "Configure a project" and configure an Android client.
Go to the Google Cloud Credentials page (select your project if necessary), download the auto-generated web client and place it in your project.
Click Assets > External Dependency Manager > Android Resolver > Force Resolve.
Change the client ID passed to LCGoogleLoginBridge.InitWithClientID in the script where you call this function.
Build and see if the issue has been resolved.
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(OAUTH_2_CLIENT_ID)
.requestEmail()
.build()
val mGoogleSignInClient = GoogleSignIn.getClient(this, gso)
val signInIntent = mGoogleSignInClient.signInIntent
startActivityForResult(signInIntent, GOOGLE_LOGIN)
OAUTH_2_CLIENT_ID is Web client (auto created by Google Service). Not Android
If you don't use your own backend server you don't need to provide OAuth 2.0 client id (as it said here). Of course check that you provided correct SHA-1 code, but remember that you are providing the release variant SHA-1 key, so this error might appear when you are trying to use Google SignIn with debug app variant. So you have 2 options:
Build and run release APK
Add your debug SHA-1 key to the Firebase console and then you'll be able to run your debug APK without this exception
Possible solve:
If you once renamed project's package check that package name in AndroidManifest.xml and applicationId in app gradle file are the same.
It helped me when I named applicationId like my application package
From my experience it is a problem with SHA1. Solution which worked for me:
Delete OAuth listings if you have created any (probably optional)
Launch this command in your project terminal keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android and copy SHA1 fingerprint.
Go to Firebase console, click gear on your project and delete old fingerprint's. Replace them with the one you copied during step 2
Download new google-services.json file and replace the old one
Sync project with Gradle files.
Should be working :)
I was facing the same issue. I was using SHA-1 credentials. But the problem was that I was directly installing the app to the testing device by using the Run button of Android Studio. In this way, I hadn't defined the debug keystore in Android Studio with which I had created the SHA-1 fingerprint.
To set the debugKeyStore Where is debug.keystore in Android Studio
In my case, it resolved by reconnect my Android Studio to Firebase.
I was getting the same error but I obtained the web client token from Google Cloud Console and placed it right where the GoogleSignInOptions is declared. Replace the
.requestIdToken("getString(R.string.default_web_client_id)")
with the web client ID for your particular Google Cloud project.
I were using this command from documentation ...
keytool -exportcert -keystore ~/.android/debug.keystore -list -v
i just change it to
keytool -exportcert -keystore ./.android/debug.keystore -list -v
and using SHA-1 and copy it into firebase android section.
it just wokrs fine.
For me the mistake was simple. I had initialized google signin options outside the oncreate callback.
If using Google Internal Sharing for testing, make sure to add also the SHA string of your internal sharing (Setup - Internal App sharing in Google Play Console)
I solve this problem by redo my Firebase Auth connection again.
Click the right top little square to login to your google account
Go to the Tool - > Firebase
Select the Authentication
Connect
After that it may say you are already connect, but you need to update the connection. After that it works fine. I think sometime Android Studio mixed up with different Firebase account.

google map authenticate failed, after package name changed

I have an android app with a Google map, everything works good.
In order to publish it in Google play, I changed the package name (old package com.exmaple..) from project----- Android tools---Rename Application Package
So, I going to generate a new API key with my new package name.
I changed manifest with the new key.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxnew keyxxxxxxxxxxxxx" />
But, it did not work. It said authentication failed.
Is there any idea? Did I miss some steps?
Thanks in advance!
If you are saying that you have generated the new key using the API Console and changed the API key in your application as well as changed the package name in those two permissions:
<permission android:name="your.application.package.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="your.application.package.permission.MAPS_RECEIVE"/>
Then try to remove your application complete from the phone, as application is usually saves the old key in the cache, and then try to re-install it.
As you have renamed your package name and Google API key is generated based on the Package name and SHA1 key to uniquely identify each application. You need to regenerate your API key and then try to apply it in your manifest file.
Please check out the documentation
To access the Google Maps servers with the Maps API, you have to add a
Maps API key to your application. The key is free, you can use it with
any of your applications that call the Maps API, and it supports an
unlimited number of users. You obtain a Maps API key from the Google
APIs Console by providing your application's signing certificate and
its package name. Add the key to your application by adding an element
to your application's AndroidManifest.xml file.
You changed your package name so google map authentication is failed. Please regenerate new key with your new package name.
Addition to the answer before.
Make sure signing API key by the release keystore instead of debug.keystore
If you checked and found that the package name is configured correctly in Google API, go over the below steps
Make sure that there is no reference in your project to the old
package name. I changed it in the manifest file but forgot to change
it in the build.gradle file
Delete the .gradle folder in your project cause gradle might have cashed the old package name
Ctrl+Shift+F to look for the old package name in the entire project.Make sure there is no trace of it
Uninstall the app on your testing device to clear any cached data
Clean project and then run it
Those steps did it for me.

Biometric/ Graphometric Signature Android

Are there any libraries or API about Graphometric Signature for Android? I need to integrate to my Android app a (biometric) graphometric signature system. Grafometric sisgnature is only valid legal signature.
you can try Namirial S.p.A. solution.
http://www.graphosign.com/
http://www.firmagrafometrica.it/
You can use the Namirial solution with Windows, Android & iOs.
They also provide an sdk for the all platform.
For more information you can send an email to: info#graphosign.com

Categories

Resources