How to solve the failed verification with zipalign? - android

I have a problem with zipalign. I can't go through the proces. Each run ends with Verification FAILED. For some files i see something like this
2574474 res/drawable-xxxhdpi-v4/abc_btn_radio_to_on_mtrl_000.png (BAD - 2)
for the reset
7044070 res/layout/notification_template_media.xml (OK - compressed)
The apk is generated but when I upload it via console I receive info that it is not compressed properly. What can I do ?

Seems like gradle has pushed a new version without the zipalign task. I had the same issue after changing this:
classpath 'com.android.tools.build:gradle:2.+'
to
classpath 'com.android.tools.build:gradle:2.1.2'
The problem was solved for me.

Chen is right.
When you upgrade your AS, you need to check your build.grade.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
check that gradle version is 2.1.2 or not.
I try 2.2.0-alpha3, and always get zipalign fialed.
Just downgrade grade version to 2.1.2
Then solve this problem.
Try it.

Related

IntelliJ IDEA generate signed bundle

I want to generate a signed bundled with IntelliJ IDEA but I always get this error no matter what I'm doing. I tried to upgrade to the Android Gradle version. I even downloaded Android Studio and set everything(updating the Gradle, sync, etc) but still the same error during the same project. Any idea how to fix it?
I took a screenshot of the error:
https://i.stack.imgur.com/dwTup.png
try to make your android level Gradle dependencies look like this:
dependencies { classpath 'com.google.gms:google-services:4.3.5' classpath 'com.android.tools.build:gradle:3.6.4' }
the gradle:3.6.4 works for me
You need to add the following line to your dependencies block
classpath 'com.google.gms:google-services:4.3.5'
For a clean code I would suggestyou parametrize the version number, so you would add the following line to buildscript block:
ext.gradle_version = 'x.y.z' // Replace with that in your current build.gradle
ext.googleservices_version = '4.3.5'
and dependencies will look like
dependencies {
classpath 'com.google.gms:google-services:$googleservices_version'
classpath 'com.android.tools.build:gradle:$gradle_version'
}

The project can be opened but can NOT be run now

I download tutorial codes from github, and I unzip it and copy paste it to where my android studio projects are. After I update to SDK 24.0.2, the project can be opened but can NOT be run now.
Pls write a bit more words for clear instructions in steps of what do I do since I am new to android studio. A lot of time I don't understand the terms you experts use.
Can NOT run the project? the green triangle run button is grey so I can NOT run it.
I got these red messages from Event Log
Gradle sync failed: Unsupported method: SyncIssue.getMultiLineMessage().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
Consult IDE log for more details (Help | Show Log) (41 s 341 ms)
I tried the repo and with only a few changes in two files was able to run the project.
update the root-level build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Updated gradle version to 4.2.1 and added google() to resolve android dependencies.
updated my gradle distribution URL in gradle-wrapper.properties.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
Please see if the 6.7.1 is supported on your android studio or not else update to the latest as per your android studio supports, mine is the latest hence 6.7.1
That is it, just by changing these two files I was able to run that app.
Note: I just did bare minimum changes just to make the app run, ideally all the dependency and everything should be up-to-date but changing all those is out of the scope of this question.
I even committed the changes in the forked version of the app code. feel free to try
https://github.com/dk19121991/Court-Counter
Gradle is an app that Android Studio uses to manage loading the libraries of code the project is built with (among other things). But since this project you downloaded is about 5 years old, the version of Gradle in the project may not match up with what Android Studio's Android plugin can support.
Typically, the Gradle app is actually part of the project. You'll see it in the gradle/wrapper directory in the project. You can update the version by editing the file gradle-wrapper.properties, by changing the value in the distributionUrl line. I think you need to make the version at least 6.7.1 if you have a recently updated version of Android Studio, so change that line to look like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
The configuration of the project is in the files named build.gradle. The weird thing is, that project seems to have an incorrect duplicate of build.gradle in the root directory of the project (it looks like the one that should go in the app directory). So you can delete the contents of that build.gradle in your root directory and replace it with what would normally be there in a new project. I just copy-pasted this out of a new project. You can paste it into that file:
buildscript {
ext.kotlin_version = "1.5.0"
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And finally, you will want to update the build.gradle file that's in the app directory so it uses the version of Android you already have downloaded (probably SDK 30). So find these relevant lines in the file and change them:
compileSdkVersion 30
buildToolsVersion "30.0.3"
//...
targetSdkVersion 30
After you've made all the above updates, press the "Sync Project with Gradle Files" button near the right end of the toolbar to reload the project from Gradle. It will take a couple minutes because it will have to download the new Gradle version.

Synchronizing Gradle failed due to unknown issues with downloads

I have been trying to fix this error all day now. All I did in the morning was update the compiler I had on my Android Studio. That's when everything went horribly wrong. Since then I have uninstalled the compiler...
These are the types of errors I keep getting everytime I try sync gradle:
Gradle sync failed: Could not find org.jetbrains.kotlin:kotlin-stdlib-jre8:1.2.0.
Searched in the following locations:
https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.pom
https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.jar
Is the latest and one I can't solve... things I've tried:
To solve the other problems I physically downloaded the jar files and
put them in the respective places (which failed with kotlin 1.2.0)...
I also added this to my gradle:
.
buildscript {
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://jitpack.io' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
This fixed my other issues...
I tried running from offline mode which failed...
I tried downloading the files into the project and referencing it like this:
.
compile files('kotlin-stdlib-jre8-1.2.0.jar')
I have long since removed the compiler just stuck as to what to do... I couldn't find any way online to fix my problem
I faced this problem after updating to new Android Studio too. You need to provide the dependency with new Kotlin version explicitly. In your app level build.gradle file add:
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.30"
Also you might need to add other dependencies:
compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.30"
compile "org.jetbrains.kotlin:kotlin-reflect:1.2.30"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.30"

No cached version of com.android.tools.build:gradle:1.2.3 available for offline mode

I installed JetBrains IDEA 15.0.2 with android support on my computer that is disconnected from Internet.
After that the project sync give an error that gradle is not existed, so I solve the problem by downloading gradle 2.2.1 and extracting it in its corresponding position
But after that a new sync error occurs that say "No cached version of com.android.tools.build:gradle:1.2.3 available for offline mode"
How can I solve error, at the same time keeping my conputer disconnected from Internet
Try the following steps:
Un-check "Offline work" in File>Settings>Gradle>Global Gradle Settings
Re-sync the project, for example by restarting the Android Studio
Once synced, you can check the option again to work offline.
I faced similar kind of issue in android studio because its also uses the gradle so my problem was app's source code was written in old version of gradle but i have the latest android studio with latest gradle. so changed the classpath dependency to have latest gradle version
Update the Classpath under dependency in build.gradle file at project level
from
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
to
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

Gradle dependency.. Kaltura Player & Google analytics incompatibility [Android]

So, I´ve been messing around this issue for a day, until I found what it seems to be the problem, but now I can´t figure out how to solve it..
I have a proyect that uses Kaltura player sdk for android (https://github.com/kaltura/player-sdk-native-android). I did some tests and it worked like a charm.. but then I tried to use it in my project and Gradle always fails when making the playerSDK with this error:
Error:Execution failed for task ':playerSDK:transformNative_libsWithSyncJniLibsForDebug'.
java.io.FileNotFoundException: ../video-android/player-sdk-native-android/playerSDK/build/intermediates/bundles/debug/jni/lib/armeabi/libHLSPlayerSDK.so (No such file or directory)
After a day trying to figure out why this happens just in this particular proyect.. I found the problem occurs just when I add Google Analytics (https://developers.google.com/analytics/devguides/collection/android/v4/). Adding classpath 'com.google.gms:google-services:1.5.0-beta2' to the build.gradle (project) will make kaltura to throw this error on make proccess.
I´m not a gradle expert, in fact, I´m pretty new with it.. but I would like to know if there is some way to exclude this project dependency when building the playerSDK module.
This is the structure I have now:
|
\-- build.gradle(Project:SampleApp)
\-- build.gradle(Module:App)
\..
\..
\-- build.gradle(Module:playerSDK)
the project build has this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:1.5.0-beta2' //<<This classpath is the problem
}
}
So, I need that classpath there to make google analytics work.. but for some strange reason, it brokes the playerSDK module.. Does anybody knows if there is a way to exclude that classpath for playerSDK module?
Thanks in advance!
Kaltura developer here. This issue was fixed in our develop branch, and will be released in a few days.

Categories

Resources