Why do I get "no manifest." and "jar is unsigned." when doing "jarsigner -verify -verbose -certs" for my APK - apk

I have one of my Android projects producing unsigned APKs. I'm using below provided configuration and then verifying produced APKs.
I'm sure Gradle is using my provided keystore file because I tried changing the path and password and the build was failing.
APKs are not signed after all
jarsigner -verify -verbose -certs /Users/viliuskraujutis/.../path-to-newly-created.apk
The output is this:
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
no manifest.
jar is unsigned.
Signing from build.gradle
For the context I'm signing like this:
android {
...
signingConfigs {
release {
storeFile file("my-key-used-in-other-successful-project.keystore")
storePassword "my-password-used-in-other-successful-project"
keyAlias "my-alias-used-in-other-successful-project"
keyPassword "my-password-used-in-other-successful-project"
}
}

You likely have a minSdkVersion of 24 or higher. If that's the case then AGP uses a more efficient signing scheme called "V2 signing" and because all Android devices on 24+ support this scheme, it is no longer needed to sign with "v1 scheme" (i.e.jar signing). V2 scheme is completely independent of jar signing, that's why jarsigner thinks the APK is unsigned. If you use apksigner (provided in Android tools), then you can check that your APK is in fact correctly signed.

The problem was as #Pierre posted yesterday - the minSdk version was 30, and since it's >23 - it uses v2/v3 signing scheme by default.
For maximum compatibility, we decided to use multiple signing schemes as per android.com recommendation.
And the fix for the app/build.gradle was that simple - we have set v1SigningEnabled and v2SigningEnabled to true. Like this:
signingConfigs {
release {
storeFile file('...')
storePassword '...'
keyAlias '...'
keyPassword '...'
v1SigningEnabled true
v2SigningEnabled true
}
}

Related

Android Studio Gradle sync failed: Unable to find valid certification path to requested target

I am getting this error on Android Studio 3.5.3. I have tried adding the maven repositories, I also tried to add Gradle manually and giving Android Studio the path. But nothing seems to work. I am also attaching a print screen. I have also installed the Keystore explorer "http://keystore-explorer.org/downloads.html". But it seems it's not working.
{
repositories {
jcenter()
***maven { url "http://jcenter.bintray.com"}***
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
mavenCentral()
***jcenter{ url "http://jcenter.bintray.com/" }
maven { url "https://jitpack.io" }***
}
}
}
Did you add a proper certification to the JDK your android project is using? You can download the certification through google chrome. Below is the solution worked for me.
Click the highlighted button and store the certification as a file.
Open Keystore Explorer as administrator.
Check JDK Location of your android project.(File > Project Structure > JDK Location)
Find security cacerts from the location above.(Generally the path is jre/jre/lib/security/cacerts)
In the KeyStore Explorer, open cacerts you find. Add the certification you downloaded to the cacerts.
Save and restart the Android Studio!

A problem occurred evaluating project ':app'. > path may not be null or empty string. path='null'

Iam facing error while iam trying to run flutter.
D:\fluttapp\testbuild>flutter run
Launching lib/main.dart on Google Pixel 2 XL in debug mode...
Initializing gradle... 2.1s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\fluttapp\testbuild\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\fluttapp\testbuild\android\app\build.gradle' line: 57
* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path='null'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to
get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
Command: D:\fluttapp\testbuild\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
D:\fluttapp\testbuild>flutter doctor -v
[√] Flutter (Channel beta, v1.1.8, on Microsoft Windows [Version 10.0.17134.556], locale
en-IN)
• Flutter version 1.1.8 at D:\flutter
• Framework revision 985ccb6d14 (3 weeks ago), 2019-01-08 13:45:55 -0800
• Engine revision 7112b72cc2
• Dart version 2.1.1 (build 2.1.1-dev.0.1 ec86471ccc)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at D:\Users\Bhanu\AppData\Local
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = D:\Users\Bhanu\AppData\Local
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.
[√] Android Studio (version 3.1)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin version 29.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] Connected device (1 available)
• Google Pixel 2 XL • 192.168.50.101:5555 • android-x86 • Android 9 (API 28)
• No issues found!
I have add repo here. I have taken sample code to make release app version but unable to generate them. Key store is created and add to code repo
https://github.com/bhanu888/buildapk
For me it was a pathing problem.
I was following the flutter guide https://flutter.io/docs/deployment/android
Create a file named <app dir>/android/key.properties that contains a reference to your keystore:
For some reason I (wrongfully) placed my "key.properties" in the app_dir/android/app folder, and this gave me the error.
* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path='null'
So check your pathing, and where your files are located :)
Bonus info:
What helped med was checking the "gradle.build" file with different settings, and it was always the storeFile file(keystoreProperties['storeFile']) that gave me problems.
Try commenting it out, or change it to:
storeFile file("key.jks")
If this works, you know that you have the correct path to your "key.jks" file. Then try introducing the poperties file (keystoreProperties)
Like
storeFile file(keystoreProperties['storeFile'])
This did not work at first, but it does now :)
So check again that you "key.jks" and "key.properties" files are located the "correct" places, and how you point to them.
If you downloaded the app from github, it is possible that signing configs are note adapted. Try like this to comment code on android/app/build.gradle :
/*signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
*/`
Solution find on :
https://github.com/transistorsoft/flutter_background_geolocation/issues/18
If you are just testing or debugging and not releasing, you might consider changing the build type to be debug instead of release.
In <APP_FOLDER>/android/app/build.gradle
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
I have used the
storeFile file(keystoreProperties['storeFile'])
on compiling it had thrown an error. But after replacing the above line with
storeFile file("key.jks")
Build was successful. I don't know how that has happened, though.
The problem occurred when you download an app from github
go to > android > app > build.gradle
in your build gradle file :--
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
Replace: storeFile file(keystoreProperties['storeFile'])
to: storeFile file("key.jks")
1)Check the Key in this Project"key.jks"
Go to "gradle.build"
and replace it
storeFile file("key.jks")
with
storeFile file(keystoreProperties['storeFile'])
There must be 2 files one with suffix
"debug"
"release"
Add these two file in your project through file explorer
Then edit the path in your file known as local.properties
debugStoreFile=C:/Users/Sachin/Android_Studio_project...
storeFile=C:/Users/Sachin/Android_Studio_project...
it works for me after deleting or comments
these lines(related to App key signing) from "build.gradle" file
//android.signingConfigs.release.storeFile rootProject.file(props.keyStore)
//android.signingConfigs.release.storePassword props.keyStorePassword
//android.signingConfigs.release.keyAlias props.keyAlias
//android.signingConfigs.release.keyPassword props.keyAliasPassword
this worked for me
Replace: storeFile file(keystoreProperties['storeFile'])
to: storeFile file("key.jks")

how to make a singed apk file with javafxPorts

anybody here developers with javafxPorts?
I was interested in gluon project, but some of sample gluon mobile sources in eclipse plugin doesn't make a signed apk file to upload the Google play store.
if you succeed in making a signed apk file, please let me know the detail solution.
i'm sure it doesnt work.
1) install Eclipse Mars(4.5.2) + Gluon Tools (e(fx)clipse IDE 2.3.0, Gradle IDE 3.7.3..)
2) Gluon Sample project (all of them including Gluon Mobile - Single or Multi View Project)
3) it works about a debug apk file through gradle, but not a release signed apk file.
is it wrong???
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
androidSdk = 'F:/android/android-sdk'
signingConfigs {
release {
storeFile file("mykey.keytool"))
storePassword "test"
keyAlias "kdc"
keyPassword "test"
}
}
}
}
what is that mean??
No such property: manifest for class: org.javafxports.jfxmobile.plugin.android.task.AndroidTask_Decorated
[BUILD FAILED]
please help me..
In the jfxmobile plugin there is no support for multiple configurations. The android task (which generates a debug apk) will always be signed with a debug keystore. To generate a signed release apk, you directly specify the signingConfig configuration and use the androidRelease task.
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
signingConfig {
storeFile file('my.keystore')
storePassword 'storePass'
keyAlias 'alias'
keyPassword 'keyPass'
}
}
}
Notice that I didn't specify a name for the signing configuration.

Android Studio Execution failed for task ':app:dexDebug'

I'm trying to start my first Android Studio app and coming across the same error over and over when I try to run or debug. I'm building a music app using the Spotify API and have imported the zipped jar files in the correct directory (under libs in my app).
What seems to be the problem is that maybe my SDK folder is in another drive? I don't think so, but it was the only thing I can think it would be. I even moved over my Android Studio folder and tried running it from the same D: drive but didn't make any difference.
I also have all the appropriate SDKs installed incl. SDK Tools, Platform-tools, SDK Build-tools 19.1, 20, API 19, 20, Android Support Repository, Library, Google Play serivces, Repository, USB Driver, and Intel Emulator.
This is the error I am getting:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
D:\adt-bundle-windows-x86_64-20140702(2)\adt-bundle-windows-x86_64-20140702\sdk\build-tools\19.1.0\dx.bat --dex --output C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\dex\debug C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\classes\debug C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\dependency-cache\debug C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\exploded-aar\com.spotify.sdk\spotifysdk\1.0.0-beta5\libs\jnihelpers-1.0.jar D:\adt-bundle-windows-x86_64-20140702(2)\adt-bundle-windows-x86_64-20140702\sdk\extras\android\m2repository\com\android\support\support-v4\19.0.1\support-v4-19.0.1.jar C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\exploded-aar\com.spotify.sdk\spotifysdk\1.0.0-beta5\classes.jar C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\19.0.1\classes.jar
Error Code:
1
Output:
'D:\adt-bundle-windows-x86_64-20140702' is not recognized as an internal or external command,
operable program or batch file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Here is some my code and gradle builds/props:
local.properties
sdk.dir=D\:\\adt-bundle-windows-x86_64-20140702(2)\\adt-bundle-windows-x86_64-20140702\\sdk
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0' // Note: this version should match the latest build-tools version
// that you installed in the SDK manager
defaultConfig {
applicationId "com.jesse.spalding.subrosa"
minSdkVersion 14
targetSdkVersion 19
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
preDexLibraries = false
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.spotify.sdk:spotifysdk:1.0.0-beta5#aar'
compile 'com.android.support:appcompat-v7:19.0.1'
}
If anyone has any idea what the deal is what this, please let me know. I need to start working on this for a final project and just can't figure this technical thing out for some reason.
The problem seems to be that your SDK is in a path that has a parenthesis in it (D:\adt-bundle-windows-x86_64-20140702(2)\adt-bundle-windows-x86_64-20140702\sdk), which is causing problems in one of the phases of the build process. Move your SDK to a path with a simpler name and update its location in Android Studio (Project Structure > SDK Location) and you should be good to go.

Gradle error on Android Studio startup

Every time I start Android Studio I get the following error:
Gradle 'VertretungsplanProject' project refresh failed: Could not
fetch model of type 'IdeaProject' using Gradle distribution
'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. A
problem occurred configuring project ':Vertretungsplan'. A problem
occurred configuring project ':Vertretungsplan'. Failed to notify
project evaluation listener. A problem occurred configuring project
':libraries:actionbarsherlock'. Failed to notify project evaluation
listener. Could not normalize path for file
'P:\Projekte\VertretungsplanProject\libraries\actionbarsherlock:Vertretungsplan\libs\android-support-v4.jar'.
The syntax for the filename, directoryname or the volume label is
wrong
My project looks like this:
Gradle settings:
build.gradle of :Vertretungsplan:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/commons-io-2.4.jar')
compile project(':libraries:actionbarsherlock')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 16
}
}
build.gradle of :VertretungsplanProject is empty.
build.gradle of :actionbarsherlock:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'
dependencies {
compile files(':Vertretungsplan/libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
When I want to compile now this error appears:
Deprecated make implementation
Old implementation of "Make" feature is enabled for this project.
It has been deprecated and will be removed soon.
Please enable newer 'external build' feature in Settings | Compiler.
After changing this setting to Use external build everything is working fine.
But this appears every time I start Android Studio and this is really annoying.
UPDATE
I deleted the android-support-v4.jar from the libs folder and simply wrote compile 'com.android.support:support-v4:18.0.0' to the build.gradle of ActionbarSherlock. Then the android-support-v4.jar is used from the installed SDK.
EDIT
Go to File > Settings > "Build,Execution,Deployment"> Compiler
Click compiler directly.
Check the option: Use external build > Apply > OK.
It worked for me !! :)
You seem to have more than one issue. Problems loading gradle on startup and problems resolving the dependency path name in your environment.
I recently found a fix for the "Failed to import Gradle project" issue, which could be linked to your dependency issue.
At least if you fix one, you know your issue could specifically be the dependency path resolution rather than a gradle/android studio issue...
Check out the troubleshooting section here:
http://developer.android.com/sdk/installing/studio.html#Troubleshooting
The basic steps are:
1. Close android studio
2. Open the SDK manager
(run android binary/executable which should be in /tools)
3. Scroll down the list and expand extras
4. Tick the "Android Support Repository"
5. Click Install Packages.. etc etc...
You need to download this as Android Studio 0.2.x needs a new maven repository used by the new build system for the support library, instead of using support library jar's.
Let us know if anything changes after trying this fix.
In the error message, the path appears: 'P:\Projekte\VertretungsplanProject\libraries\actionbarsherlock\:Vertretungsplan\libs\android-support-v4.jar'
It looks like you're on Windows. The semicolon before Vertretungsplan is not a legal filesystem character. This appears in your script as
compile files(':Vertretungsplan/libs/android-support-v4.jar')
Try changing this to
compile files('Vertretungsplan/libs/android-support-v4.jar')

Resources