Android studio not generate signed apk - android

recently I updated my working android studio IDE into Android Studio 1.5.1. but now I'm facing some trouble as after updating it did not generating signed apk file. but when I plug a device and run the app, it runs properly. when I use
Build -> Generate Signed Apk
in the Event Log it shows
10:38:51 AM Executing tasks: [:app:assembleRelease]
and the slider shows some time and it disappear. It does not show build generation completion dialog too. then I change build variant and try to run the app using a connected device. and in the Event Log it sows
10:43:32 AM Executing tasks: [:app:assembleDebug]
after few seconds a pop up coms saying Apk(s) generated successfully, but still the signed apk is not there at the relavent folder. and the app runs in the device properly. and my full Event Log is as follow.
10:38:51 AM Executing tasks: [:app:assembleRelease]
10:43:32 AM Executing tasks: [:app:assembleDebug]
10:43:46 AM Gradle build finished in 13s 964ms
10:43:46 AM Generate Signed APK
APK(s) generated successfully.
Reveal in Finder
10:43:46 AM Generate Signed APK
APK(s) generated successfully.
Reveal in Finder
10:43:46 AM Generate Signed APK
APK(s) generated successfully.
Reveal in Finder
10:43:46 AM Generate Signed APK
APK(s) generated successfully.
Reveal in Finder
10:43:47 AM Generate Signed APK
APK(s) generated successfully.
Reveal in Finder
10:43:47 AM Generate Signed APK
APK(s) generated successfully.
Reveal in Finder
10:43:47 AM Generate Signed APK
APK(s) generated successfully.
Reveal in Finder
10:43:52 AM Session 'app': Launched on samsung-sm_t211-4100cede9628b000
also my build.gradel file is as following.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '23.0.0 rc3'
defaultConfig {
applicationId "com.lf"
minSdkVersion 14
targetSdkVersion 19
versionCode 63
versionName '2.0.9'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile project(':holoColorPickermaster')
compile project(':qRCodeReaderViewlib')
compile project(':volley')
compile project(':library')
}
so how can I fix this. I fully update Android studio after this was happen and it still the same.

I was facing same issue but i resolved the issue by adding below code in build.gradle
lintOptions {
checkReleaseBuilds false
}
This issue would occur, Sometimes our application not follow all the rules and regulation according to Lint Tool
Note: Add this in application module inside android

For Android Studio 3, instead of putting the APK directly into the folder, it creates a "release" folder or a folder that matches the flavor of your build.
So when you click locate, it puts you at the app level. You need to go into the release folder to get your APK file.
Typically you'd look in the release folder:
But if you built some other flavor aside from the release flavor, you would look for a folder with that name.

Ensure that your keystore is correct, with the correct passwords and
paths.
Then clean and rebuild.
Assemble (NOT EXECUTE OR RUN) the required build
Then 'Generate signed APK'

I fixed this issue by completely removing Android studio and it's related files and re install it. and now its working perfectly. it may be some issue with the plugins I'm using with the IDE. So in my mac I used following terminal commands to remove android studio
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Caches/AndroidStudio*
rm -Rf ~/.gradle
rm -Rf ~/.android
then I re install the IDE and install necessary SDKs. this fixed issue for me.

Related

Task 'installRelease' not found in root project 'VotePlus'. Some candidates are: 'uninstallRelease'

i Just cloned a react native project and changed the name according to my project name , But it works in debug apk but doesn't works on Release apk got error below screenshot . Does anybody have an idea on solving this and release apk .
https://i.stack.imgur.com/O20Mq.png
We don't have installRelease. you can bundle the release with Gradle's assembleRelease command
cd android
./gradlew assembleRelease

How can I use Gradle to build Android applications from the command line

I'm just trying to adapt to Android Studio, and I'm not enjoying it much.
A cursory glance at the Gradle site suggests that an aim is to be able to make the same build from the command-line as the IDE. If so, presumably it's possible to use Gradle to build Android Studio projects wtihout running Android Studio.
How can I do this? Are there any online examples?
Building in Debug Mode
For immediate application testing and debugging, you can build your application in debug mode and immediately install it on an emulator. In debug mode, the build tools automatically sign your application with a debug key and optimize the package with zipalign.
On Windows platforms, type this command:
> gradlew.bat assembleDebug
On Mac OS and Linux platforms, type these commands:
$ chmod +x gradlew
$ ./gradlew assembleDebug
To see a list of all available build tasks for your project, type this command:
$ ./gradlew tasks
Building in Release Mode
Build signed and aligned
If you would like, you can configure the Android build script to automatically sign and align your application package. To do so, you must provide the path to your keystore and the name of your key alias in your modules's build.gradle file. With this information provided, the build will prompt you for your keystore and alias password when you build using the release build type and produce your final application package, which will be ready for distribution.
To specify your keystore and alias, open the module build.gradle file (found in the root of the module directory) and add entries for storeFile, storePassword, keyAlias and keyPassword. For example:
storeFile file("myreleasekey.keystore")
keyAlias "MyReleaseKey"
Save your changes. Now you can build a signed .apk in release mode:
Open a command-line and navigate to the root of your module directory.
Edit the build.gradle file to build your project in release mode:
...
android {
...
defaultConfig { ... }
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
}
Hope it helps

Unsigned apk generation with Android Studio doesn't work

I generated my project with Cordova, I'm using Android Studio to develop my app, I can test the app on a connected Android platform, but I'm not able to generate apk. I run Build -> Build APK the IDE says Build APK: APK(s) generated successfully. Reveal in Finder, but I cannot find anywhere the generated APK (I searched it in my filesystem).
I added a build-extras.gradle containing:
android { lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
And in select build variant I choosed debug.
Any suggestion?
Thanks

Android Studio : install Release App by command line

I want to export apk file "release apk" from command line
when I run this command : gradlew installRelease
and I found this
Android Studio Task 'install Release' not found in root project ''.
Some candidates are: 'uninstall Release'.
How can I solve it?
My experience has been that the installRelease task does not become available until you define the signingConfigs in the buildTypes.release block of your build file, as shown in step 3 of Signing in Release Mode. Without signingConfigs, you will get other release tasks, such as assembleRelease, but not installRelease.
So there is no such task. You can see all available tasks calling gradlew tasks. To assemble release version of apk call gradlew assembleRelease and then using adb install it.
You may build with Android Studio Build/Generate Signed APK.... In this case you'll get .apk file in your repository. You then can use adb install .apk to install it. You'll have no changes in build.gradle file in this case.
Alternatively you may change build.gradle file as mentioned here. In this case you will have installRelease task. You may get these changes in build.gradle using Open Module Settings menu. See details in Gradle for Android and Java course from Udacity.
In my case, the installRelease option didn't show up until I deleted the line
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {

How to build a 'release' APK in Android Studio?

I am trying to build an APK that I can upload to the Play Store.
When I select Build|Generate Signed APK... in Android Studio (version 0.3.1), I am directed to a link on how to properly set up the signing process in the "gradle build scripts":
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Signing-Configurations
Unfortunately, after checking that page I'm at a loss as to what file to edit and what to put in it - I'm coming from a Visual Studio background, so lazily expect stuff to 'just work' :).
(After OK'ing Android Studio's warning message, A.S. brings up a Generate Signed APK Wizard, which I went through, passing my key's details. The resulting APK was rejected by the Play Store for having a key with a too-soon expiry-date).
I also tried bringing up the Android Studio Terminal window and running 'gradle', as instructed in the above message, but this command was not found. So as an aside, since perhaps running the command might do something useful, how would I run gradle?
I found a 'Gradle' window in the A.S. IDE, and tried building the assembleRelease target found in that window. However, the Run window output just shows "Executing external task 'assembleRelease'...".
Follow these steps in the IDE: Build -> Generate Signed APK -> Create new...
Then fill up "New Key Store" form. If you wand to change .jnk file destination then chick on destination and give a name to get Ok button. After finishing it you will get "Key store password", "Key alias", "Key password"
Press next and change your the destination folder.
Then press finish, thats all. :)
Click \Build\Select Build Variant... in Android Studio.
And choose release.
AndroidStudio is alpha version for now. So you have to edit gradle build script files by yourself. Add next lines to your build.gradle
android {
signingConfigs {
release {
storeFile file('android.keystore')
storePassword "pwd"
keyAlias "alias"
keyPassword "pwd"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
To actually run your application at emulator or device run gradle installDebug or gradle installRelease.
You can create helloworld project from AndroidStudio wizard to see what structure of gradle files is needed. Or export gradle files from working eclipse project. Also this series of articles are helpfull http://blog.stylingandroid.com/archives/1872#more-1872

Categories

Resources