Unsigned apk generation with Android Studio doesn't work - android

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

Related

VSCode can't find ndk react-native

I have a simple react-native project when I try to build an android release version of the application, I face this error message:
Caused by: java.lang.RuntimeException:
org.gradle.api.InvalidUserDataException: NDK not configured. Download
it with SDK manager. Preferred NDK version is '21.4.7075529'
I made a Keystore and set password like android studio to get a release and debug apk.
I tried this until now:
I tried to set NDK in android studio but couldn't build the project.
I also modified build.gradle to build the project but was unsuccessful.
I put my singingConfig and buildTypes and also stackTrace below.
my keystore data
singingConfig and buildTypes
What went wrong:
A problem occurred evaluating project ':expo'.
A problem occurred configuring project ':expo-modules-core'.
Failed to notify project evaluation listener.
> org.gradle.api.InvalidUserDataException: NDK not configured. Download it with SDK manager. Preferred NDK version is '21.4.7075529'.
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
Open root folder projectname > android > open local.properties > copy and paste below lines after sdk.dir (if you don't have a local.properties file copy the below file and change SDK path according to your operating system.)
sdk.dir=/Users/yourusername/Library/Android/sdk
ndk.dir=/Users/yourusername/Library/Android/sdk/ndk/21.4.7075529 (You should find this version in the NDK folder and the path will vary depending on your operating system.);
I solved this problem using another way to get release version of the apk.
I used eas build -p android or expo build:android and finally after a really long time expo generates apk on his website. But it was too large application about 60mg and I'm trying to reduce it's size.
eas build -p android this command is for abb version
expo build:android this is for apk release.
but unfortunately, I Couldn't use gradle in order to release apk.

Build error in android studio after updating to stable Android studio 3.1.2

I was trying to build an application. I was successful in making project(ctrl+F9) after that I tried to run my application on the emulator in this process I got the build error. To fix this issue I got a suggestion from Android studio to change build script to following:
To proceed, either fix the issues identified by lint or modify your build script as follows:
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release
//builds,
// but continue the build even when errors are found:
abortOnError false
}
}
Where could I find the build script? So, that I can change it. I am a newbie to the Android world.
The build script can be found in the Gradle Scripts option in the very left of the screen.
Click the Gradle scripts to display all the gradle files and there you will find
These two files marked with red color are the build.gradle files for your project.
try to clean your project, then build it again. if the result still the same, try to invalidates cache & restart.
Go to android studio then File -> Invalidate Caches / Restart...

Android studio not generate signed apk

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.

Why won't Android Studio create my AAR file in release mode

Using Android Studio, I have an Android library project which produces 'library/build/outputs/aar/MyLIB.aar" just fine in Debug mode, but does not do so in Release mode. I see no errors, just "BUILD SUCCESSFUL" in the "Gradle Console" window but no Release Mode artifact.
There was a similar question raised here, and I'm getting the same behavior as #user1624552 mentions in the link:
"gradlew clean" followed by "gradlew aR" resultd in my AAR being created and correctly placed in the directory above. But using Android Studio and the "Release Mode" Build Variant does NOT create an AAR file.
Is there something configured in the Debug variant which is not configured in the Release variant?
Thanks,
ALF
Right click the task you want and click "Run".
To get the aar, you can do the following
“View/Tool Windows/Gradle”, to open the gradle window
From gradle window, run assembly Gradle task by double-click on My_Plugin_Android/:My_Plugin/Tasks/build/assemble

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