Unable to zipalign apk android android studio 2.2 - android

I am publishing my app using android studio 2.2 preview 3 and generating signed apk. But when i am uploading apk to google play i am getting error
You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again.
Also i tried to used zipalign tool manually but i am getting error verification failed.
Here is my build.gradle file
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "blackdogs.newaomsi"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
zipAlignEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}}

Got it. Error was due to gradle version i was using.
Downgraded gradle version to
'com.android.tools.build:gradle:2.1.2'

This is a known issue with Android Studio 2.2 Preview 3, as explained in this blog post and this issue.
You have to download Preview 2 or use the stable version of Android Studio.

solved in the next release
classpath 'com.android.tools.build:gradle:2.2.0-alpha4'
reference link:https://code.google.com/p/android/issues/detail?id=212591

Related

Android app is not building after change the android studio version

I created an Android app using the android studio (2016) with the following parameters
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.2.1'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.stl.sciocardio.app.androidapp"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Also, I use third party projects inside the project as well. When I change the Android studio 2020 the app is not built or even not detected as an android project. It gives me the following error once I try to rebuild it
Unable to find Gradle tasks to build: [:app, :, :GraphView-master].
Build mode: REBUILD.
Tests: None.
How can I fix the issue?
Try this:
Delete folders [build, .idea, .gradle]
Invalidate Caches / Restart
If it does not get resolved, then repeat the above step by removing
include ':app' from settings.gradle

Android Studio signs APK only when Build APK is chosen and not when Run button is clicked

Android Studio signs an APK only when I go Build/Build Bundles Apks/Build APK. When the run button to automatically run it on the emulator is clicked the application is not signed. I have verified this by inspecting the application with adb pull from the emulator.
The following is the build gradle I have:
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/home/pc/.android/debug.keystore')
storePassword 'android'
}
}
defaultConfig {
applicationId "com.example.app"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
custom {
signingConfig signingConfigs.config
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable true
}
}
}
I am choosing from the build variants the custom one I have created.
I havent touched this app for a while now but a similar project I had was working properly several months ago. Is there some update or something else that is causing this behavior? Am I missing something?
Android Version 3.6.1
Java Version = java-8-openjdk
I know the config is correct as the Build APK actually signs the APK
I know that the APK installed on the emulator when the button run is clicked does not contain the signature as i have inspected the META-INF directory of the apk. But i have also verified it by trying to print the signature programmatically.
According to Android user guide the run button should have the same result as the Build APK!
What could be the issue of the above and how to solve it?
I spent a considerable amount of time trying to solve this and I hope to save some time from anyone else facing this.
Go to Run/Edit Configurations
In the tab General in section Installation Options
In Deploy choose APK from app bundle

App not installed after upgrading to Android - P

App is installing while connecting via USB to mobile, but while sending .apk file to others it saying "App not Installed"(both debug and release).I have tried different solutions from stackoverflow but none worked for me.
1.How to overcome app not installed error when building from Android Studio 3.0?
2.Cannot install signed apk to device manually, got error "App not installed"
3.Android Studio 3.0 Unsigned Apk Not Installing
Below is my build.gradle(app level)
android {
compileSdkVersion 'android-P'
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "XXXXXXX"
minSdkVersion 15
targetSdkVersion 26
versionCode 51
versionName "1.51"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions{
disable 'MissingTranslation'
}
}
Please help me on this.Thanks in Advance.
You can override testOnly flag adding following line to gradle.properties:
android.injected.testOnly=false
Android P preview SDK is a preview and you should not be distributing APKs built with it. Use a non-preview SDK for compiling APKs that are meant for other people to use.
Technically, the installation limitation is that the APKs have testOnly flag set to true. To work around that, see ADB Install Fails With INSTALL_FAILED_TEST_ONLY

Google Play Store is missing in Android Things

Did anyone successfully build location service into Android Things? I am trying to use LocationServices, but it cannot connect with Google Play.
It complains "W/GooglePlayServicesUtil: Google Play Store is missing." and ConnectionResult is {statusCode=SERVICE_INVALID, resolution=null, message=null}
I have setup wifi on Android Things (Intel Edison) and it can fetch a webpage successfully.
The following is my gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.example.androidthings.myproject"
minSdkVersion 24
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:10.2.6'
provided 'com.google.android.things:androidthings:0.4-devpreview'
}
My first ever question on stackoverflow. Many thinks for your help!
compile 'com.google.android.gms:play-services:10.2.6'
Android Things Developer Preview 4 does not support 10.2.6. It supports 10.0.0, as is noted in the release notes. My guess is that your Java code (which is not shown in your question) is going through a code path that is trying to upgrade Play Services to match your 10.2.6, and that is where you are getting your error.
Android Things does not include the Google Play Store, which is responsible for automatically updating Play Services on the device. Because the Play Services version on the device is static, apps cannot target a client SDK greater than the version bundled with the target release. Source :- https://developer.android.com/things/sdk/index.html

Android Studio and Getting Maps Correctly installed

I am new to Android Studio, but I currently get this error:
error: package com.google.android.gms.maps does not exist
Now, if I in
project/module/build.gradle I do this
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
} }
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile files('src/main/libs/google-play-services.jar') }
I currently get this error:
Could not find method
android.webkit.WebView.setWebContentsDebuggingEnabled
And earlier I got this
Could not find class 'com.google.android.gms.maps.SupportMapFragment'
Whatt is the correct thing to do here / how do I solve above errors?
For reference: I orignally manually converted this project form a broken Eclipse project - sadly, for both Eclipse builds and Android Studio builds, it is the map/library thing that I seem unable o solve. The app is otherwise still working as it was before.
Replace
compile files('src/main/libs/google-play-services.jar')
with
compile 'com.google.android.gms:play-services:4.0.30'
or use newer version if you want.
You need to have Google Play Services downloaded in SDK.

Categories

Resources