could not generate APK on react native : :app:lintVitalRelease - android

I create a key with this command :
keytool -genkey -v -keystore first-key.keystore -alias first-key-alias -keyalg RSA -keysize 2048 -validity 1000
and add this to gradle file :
signingConfigs {
release {
storeFile file('/home/mohamadreza/keys/first-key.keystore')
storePassword '1234567890'
keyAlias = 'first-key-alias'
keyPassword 'qq-2012'
}
}
buildTypes {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
then I run this command:
cd android && ./gradlew assembleRelease
I got this error:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all task dependencies for configuration ':app:lintClassPath'.
> Could not find com.android.tools.lint:lint-gradle:26.4.2.
Searched in the following locations:
...
my classpath : classpath('com.android.tools.build:gradle:3.4.2')
how can I fix it?

This same issue I faced today.
I tried the following thing:
I deleted the output.json file from the folder
"yourProject/android/app/build/outputs/apk/release".
And RUN command to build the application.
It worked for me.
Hope will work for you too

Related

Execution failed for task ':app:signReleaseBundle' [duplicate]

I'm having a problem while running this command on Flutter: flutter build appbundle --target-platform android-arm,android-arm64,android-x64 which I need to run in order to execute flutter build apk.
build.gradle
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
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
}
}
key.properties
storePassword=XXXX
keyPassword=XXXX
keyAlias=key
storeFile="C:/Users/User/Key/key.jks"
Error:
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'D:\Projects\Flutter\iusefully\android\app\"C:\Users\User\Key\key.jks"' not found for signing config 'release'.
I finally found the answer,
my problem was in the key.properties file.
The problem occurred because I used storeFile="LOC"
The declartion of this variable for the path of the .jks should NOT be in " "
quotation.
WRONG:
storeFile="C:/Users/User/Key/key.jks"
RIGHT: storeFile=C:/Users/User/Key/key.jks
In addition, I added the key.jks file to the /app folder.
this solution work for me...
follow this instruction
https://flutter.dev/docs/deployment/android#create-a-keystore
and in key.properties don't put values inside ""
ex:
storePassword=454545
keyPassword=456565
keyAlias=upload
storeFile= C:/Users/{profile}/upload-keystore.jks
Change your key location c to d drive...
Same time permission issue occurred with c drive
For me it helped to rename file
{home}\.android\debug.keystore to {home}\.android\debug.keystore.jks
In addition to t0m3r's answer, when running the command below on windows: change USER_NAME to your user name
keytool -genkey -v -keystore c:\Users\USER_NAME\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload

Flutter - Azure Devops: Sign android on PC & on azure devops without sharing the JKS and key.properties file through git?

I built an Azure Devops pipeline what signs the apk after it is done:
- task: AndroidSigning#3
displayName: 'Signing and aligning APK file(s) **/*.apk'
inputs:
apkFiles: '**/*.apk'
apksign: true
apksignerKeystoreFile: upload-keystore.jks
apksignerKeystorePassword: $(upload-keystore-password)
apksignerKeystoreAlias: upload
apksignerKeyPassword: $(upload-keystore-password)
It signs the APK as it should. The problem that I have this in my build.gradle:
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.debug
shrinkResources false // Add this line
minifyEnabled false // Also add this line
}
}
As you can see it is not setup to sign by my key. Like this the signing works in pipeline but does not work if I use the flutter build apk in console.
But if I setup the build.gradle as the docs says https://docs.flutter.dev/deployment/android:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Then the pipeline throws the
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
error because I'd rather not git add the key.properties that has the password or my JKS file that I sign the APK with.
I'd like the pipeline to work but also if I use the flutter build apk command it gives me a signed APK.
What could be the solution?

You have sent a signed APK or Android App Bundle in debug mode. Sign it in release mode. How to fix it (flutter)

I have to generate an APK to publish the app in Google Play Store, so I did this steps:
run keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key and paste the file key.jks inside android/app
create a file in android folder named key.properties with this content:
storePassword=myPass
keyPassword=myPass
keyAlias=KEY
storeFile=/app/key.jks
added this code in app/build.gradle:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
Pasted this code in app/build.gradle:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
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.debug
}
}
Run flutter clean
Run flutter build apk --split-per-abi --release:
But when I send the apks to google play publish I receive this message:
You have sent a signed APK or Android App Bundle in debug mode. Sign it in release mode
What I need to do?
Remove the duplicate buildType release
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.debug
}
}
Or rename to debug.
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}

How to use gradleW in order to get a signed apk from command line?

I'm trying to have a jenkins job to automatically compile and sign my APK file with a keystore I have in a folder. I've tried this:
SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79
SET ANDROID_HOME=E:\androidsdk
SET PATH=%PATH%;%JAVA_HOME%;%ANDROID_HOME%
SET ZIPALIGN="%ANDROID_HOME%\build-tools\23.0.3\zipalign"
echo %cd%
gradlew assembleDebug & "%JAVA_HOME%\bin\jarsigner" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key-jenkins\MyKey.jks -storepass rusavon app\build\outputs\apk\app-debug-unsigned.apk Mypassword& %ZIPALIGN% -v 4 app\build\outputs\apk\app-debug-unsigned.apk app\build\outputs\apk\debug-r%SVN_REVISION%.apk
but it's not working. (it used to work in other project where gradle was used instead of gradlew).
You should consider adding build types and signing config in build.gradle and then running the ./gradlew assembleRelease
It should build a signed apk.
Make following changes to build.gradle.
buildTypes {
// Debug Configuration
debug {
testCoverageEnabled = true
debuggable true
}
// Release Configuration
release {
testCoverageEnabled = false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
and then have these signing configs :
signingConfigs {
debug {
storeFile file("xx-key.keystore")
storePassword "xx123"
keyAlias "xxxx"
keyPassword "xx123"
}
release {
keyAlias 'xxxx'
keyPassword 'xx123'
storeFile file('xxxxxx-Key.keystore')
storePassword 'xx12'
}
}
Run command to generate signed apk : ./gradlew assembleRelease

Error building Android app in release mode, in Android Studio

I'm trying to sign my android app in release mode, in Android Studio.
I followed this official guide. So I have created the keystore and a private key. Then I tried to Generate the Signed APK, from Build -> Generate Signed API Key. But the build fails, with the following error:
:app:packageRelease FAILED
Error:A problem was found with the configuration of task ':app:packageRelease'.
> File 'C:\Documents\myapp\android.jks' specified for property 'signingConfig.storeFile' does not exist.
I have also checked the build.gradle configuration. And I have found this:
signingConfigs {
releaseConfig {
keyAlias 'xxxxxxxxxx'
keyPassword 'xxxxxxxxx'
storeFile file('C:\Documents\myapp\android.jks')
storePassword 'xxxxxxxxx'
}
}
but in the same gradle file I have this:
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseConfig
}
}
What's wrong?
Replace \ by \\:
storeFile file('C:\\Documents\\myapp\\android.jks')
I have solved the problem, simply moving the keystore inside the base path of my android project.
Place the keystore file in app folder of that project, and replace with following
storeFile file('android.jks')

Categories

Resources