Instant App Uploading APK is failed - android

I'm trying to add my APKs to Play Store but it gives an error :
Upload failed
Your Instant App APKs contains an APK name 'productdetail' that either does not exist or was not included.
Any idea why can it happen?
Thanks for your help!

A few things you could check here:
Make sure you are uploading the ZIP file, and it does contain the productdetail APK. You need to upload all APKs at once.
In your base module, you have feature project(':productdetail') in your dependencies section of your build.gradle file. (Modify the relative project path if product detail does not sit in the root folder of the project)
In your instant apps project-level build.gradle (i.e. the one with com.android.instantapp plugin applied), you have implementation project(':productdetail') in your dependencies section.
Detailed explanation of project structure could be found here: https://developer.android.com/topic/instant-apps/getting-started/structure.html
I would also recommend checking out Hello World code samples from https://developer.android.com/topic/instant-apps/samples.html and compare your build.gradle against the samples to spot mistakes in build files.

Related

File 'root/lib/META-INF/MANIFEST.MF' uses reserved file or directory name 'lib'

I tried to apply for app bundle but I failed.
I can build apk with spilit option but I couldn't make aab.
I put the following gradle option.
bundle {
abi {
enableSplit = true
}
}
The error message in the console is below.
File 'root/lib/META-INF/MANIFEST.MF' uses reserved file or directory name 'lib'.
The file structure that was built is like below.
I heard I have to add the below library, but I didn't.
Actually, there is no difference either I add the play core library or not.
implementation "com.google.android.play:core:$play_version"
I wanna change some options to avoid alias problem but I don't have any idea about that.
Anyone who can handle this problem simply?
Make sure you don't have a directory called "lib/" in your project, since this directory name is reserved in the APK format for storing native libraries.
If not in your project, one your library dependencies must have it and is being copied into the APK.
The reason it works for APKs but not AABs is that the AAB format is more strict and will prevent you from embedding unnecessary files in your app.

Is it possible to extract google-services.json from the apk file?

New to android development. When we distribute the .apk file, can the receiver extract the google-services.json and use our database or authentication database.
I looked
I have apk file, Is it possible to get android studio project from apk?
and Is google-services.json confidential?
and Is it possible to decompile an Android .apk file?
but don't directly relate
I tried to extract an apk of mine which has google-services.json file and I couldn't find the google-services.json file in extracted folder .
Edit : Here is more info I found
The google-services plugin has two main functions:
1 - Process the google-services.json file and produce Android resources that can be used in your application's code. See Adding the
JSON File more information.
2 - Add dependencies for basic libraries required for the services you have enabled. This step requires that the apply plugin:
'com.google.gms.google-services' line be at the bottom of your
app/build.gradle file so that no dependency collisions are introduced.
You can see the result of this step by running ./gradlew
:app:dependencies.
This means that the google-services.json file will be converted to android resources by google-services plugin during build process .
You can find how google-services.json works over here
can the receiver extract the google-services.json and use our database or authentication database.
Even if the receiver extracts credentials from apk , he cannot access database as the SHA-1 will be different .

Gradle build failing due to keystore.properties file missing

I'm trying to use this alarm app on Android Studio - https://github.com/philliphsu/ClockPlus . However, gradle build is failing (error message below). Please let me know what needs to be fixed for this to work.
Error:/Users/***/Documents/Apps/ClockPlus-master/keystore.properties (No such file or directory). Let me know what exactly is this keystore.properties and is it possible to create this file as it's not available in the github repo files.
what exactly is this keystore.properties?
When you want to publish your app in the google play, you need to sign your app. When you create a signing configuration,Android Studio ,by default, adds your signing information in plain text to the module's build.gradle files. If you are working with a team or open-sourcing your code, you should move this sensitive information out of the build files so it is not easily accessible to others. To do this, you should create a separate properties file to store secure information and refer to that file in your build files. That file is the keystore properties file.
Read more about this
Is it possible to create this file as it's not available in the github
repo files?
Create a file named keystore.properties in the root directory of your project. This file should contain your signing information, as follows:
storePassword=myStorePassword
keyPassword=mykeyPassword
keyAlias=myKeyAlias
storeFile=myStoreFileLocation
If you do not have store password, key password etc. you should sign your app.
Read more about this
The whole information about this is in the Android Developer documentation, in the link I provided above.

Load google-services.json from local file system

The google-services.json file used by the Firebase Android plugin is usually put in the app's module folder.
What I do want to do instead is put this file somewhere on the filesystem completely outside the project folder and let gradle / the Firebase plugin read it from there.
I thought about putting it's location in the local.properties and somehow 'tell' the Firebase plugin to get the location of the google-services.json from there.
How can I achieve this?
According to offical documentation, the google-services.json file is generally placed in the app/ directory (at the root of the Android Studio app module). As of version 2.2.0 the plugin supports build type and product flavor specific JSON files. All of the following directory structures are valid:
// dogfood and release are build types.
app/
google-services.json
src/dogfood/google-services.json
src/release/google-services.json
...
Note: Providing a google-services.json file in the release directory allows you to maintain a separate Firebase project for your production APKs.
When product flavors are in use these more complicated directory structures are also valid.
// free and paid are product flavors.
app/
google-services.json
src/dogfood/paid/google-services.json
src/release/free/google-services.json
...
As a conclusion, you cannot add google-services.json file outside your project.
Hope it helps.

Difficulties setting up Gradle to send ProGuard mapping files to Firebase

I am trying to follow this documentation tutorial by Firebase to setup Android Studio to automatically send my ProGuard mappings file when building a release APK for my Android application.
However, I couldn't seem to understand steps 4 and 5 in the "Uploading ProGuard mapping files with Gradle" part, mainly because I didn't find any gradle.properties file in my project root or home path and because I wish to automate the execution of the app:firebaseUploadReleaseProguardMapping task in Android Studio, which I don't know how to do.
This is the contents of the gradle.properties file I've created in my project root directory:
FirebaseServiceAccountFilePath = /app/firebase-crash-reporting.json
The firebase-crash-reporting.json file is my Firebase crash reporting private key. My mappings file is generated in the /app/build/outputs/mapping/release/ directory, if that helps.
Please assist me in completing those 2 steps and automatizing the process in Android Studio.
Just add
afterEvaluate {
assembleRelease.doLast {
firebaseUploadReleaseProguardMapping.execute()
}
}
In the android section of build.gradle file.
This will automatically upload the ProGuard mappings file to Firebase as well as run/deploy the APK to the device using ADB.
gradle.properties is owned and managed completely by you. You have to create it if it doesn't already exist. This means you should probably read the Gradle documentation on it to best understand how it provides properties to your builds, and which location is best for your properties.
You are not even obliged to use gradle.properties. You can also specify all the properties for the Crash Reporting plugin via the command line.
When you specify a path for the service account file, you should specify the full, unambiguous path to the file. In your example, it looks like you're assuming that it will look under the app directory in your project. If you want to do that, you still have to give the full path to the file.

Categories

Resources