how can I compile android project to apk - android

at the first experience with android, I don't install android studio!
Just cloned a project and search according to see gradlew.bat file. but when I run it:
PS D:\projects\android> .\gradlew.bat assembleDebug g
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:\projects\android\settings.gradle'
* What went wrong:
Could not compile settings file 'D:\projects\android\settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 61
java.lang.IllegalArgumentException: Unsupported class file major version 61
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
...
my settings.gradle:
include ':vlc-android-sdk-3.0.0'
include ':app'
rootProject.name = "DSM"
is SDK needed? what's emulator has used in this link: https://developer.android.com/studio/build/building-cmdline
how can I build apk finally?

Yes, you need the Android SDK to build, run and debug apps! if you don't want to install Android Studio, you can download the basic Android command-line tools from this link: https://developer.android.com/studio#downloads. You can use the included SDK manager to download other SDK packages.
The above-mentioned error is also thrown when an incorrect JDK version is installed in your system. [Also] make sure you also set up environment variables like ANDROID_HOME, JAVA_HOME, and platform-tools with their respective locations on your pc. most of this setup is taken care of by default on installing Android Studio!

I never use this method to compile my android project into an .apk
I use an alternative method which I find easier than compiling .apk in the android project.
What I do is -
Build the Android Project by clicking on the build icon.
After the build is successful, Open File Explorer of on your PC.
Then going to the file location - D:\User\Android Studio 4.0.1\Applications\SampleApp\app\build\outputs\apk\debug
Now drag the .apk file to upload it anywhere!
For testing it in mobile without connecting USB, you can Gmail yourself by uploading the file through Google Drive. And then downloading the .apk through Gmail in the Mobile Device.
NOTE : the file location I have mentioned in Point 3 is different than yours, because I always keep my projects in D: drive. It would be similar after you go to your application folder (after SampleApp folder).

Related

React Native AppCenter build problem - "JAVA_HOME_11_X64"

I updated most app packages, updated gradle (distributionUrl=https://services.gradle.org/distributions/gradle-7.5-bin.zip) and gradle tools ('com.android.tools.build:gradle:7.3.0').
I can make apk file through android studio. I can work with the emulator.
I tried to build via AppCenter and got an error that I need to use JAVA 11.
In the builder configuration, I inserted the parameter - JAVA_HOME => $(JAVA_HOME_11_X64).
The build was assembled successfully.
But if I try to install apk on my phone I get an error (see screenshot)
Also, the size of the apk file has increased by 2 times, which is very strange.
I can't install the apk file created through the AppCenter.
Perhaps someone faced such a problem? I will be grateful for advice.
image

Cant't config downloaded (zip) NDK for Android Studio (windows 7)

so I tried to download NDK from StandAlone SDK manager and it didn't have the option! then I went to google developers and read some guides and understood how to get it via android Studio
there was an NDK option in SDK manager -> SDK tools tab , I checked it and after applying it started downloading it, but for some reason after download, it fails to install it (tried 2 time it fails at end of unzipping process at like 100% :| ) ***Note: I have enough space available, 4gb on windows drive, 20gb on SDK drive
***Note2: I deleted the NDK bundle folder and its contents created by the failed install in my SDK folder
so I went to NDK Download
and downloaded the package from there , but I can't get it to work, gradle says "Error:NDK not configured.
Download it with SDK manager.)"
I tried adding the NDKfolder to PATH variable or adding NDK_HOME variable but still the same error
Update 1 : I added ANDROID_NDK_HOME variable now it says : Error:A problem occurred configuring project ':TMessagesProj'.
I had this issue of
Error:NDK not configured. Download it with SDK manager.)
But I solved my problem with this link: Add C and C++ to your Project
you can skip to the heading Download the NDK and Build Tools, but read everything for knowledge.
This error might be, your Android Studio is not able to find the NDK location.
So, try doing this: right click on your project in Android Studio,select "Open Module Settings", select SDK location tab, and provide SDK and NDK locations.

Android Studio - Error: Local path doesn't exists - No apk generated

I recently downloaded latest version of Android Studio today. I configured and setup everything properly but when i create a new project and try to run and debug in the connected phone, it will show this error.
Error: Local path doesn't exists.
Also, i search for apk file but no apk was generated anywhere.
I am using Android Studio 1.0 built on December 5 2014.
SDK manager is also no starting from Android studio.
Please help.
I got the same problem since update to 1.0 version, the bug comes from an internal script which is supposed to finds the distribution of Java but isn't working correctly on 32-bit Windows systems (SDK Manager was also impossible to run) and it has been fixed in the 24.0.1 release of the SDK.
Solution :
In line 27 of tools/lib/find_java.bat has a problem:
find /i "x86" > NUL && set arch_ext=32 || set arch_ext=64
You must remove space after "arch_ext=32". Correct code is:
find /i "x86" > NUL && set arch_ext=32|| set arch_ext=64
You should be able to open SDK Manager by now, and update Android SDK Tools.
Read this possible duplicate
Android Studio - local path doesn't exist
As for the APK, it does not get generated unless you do it.
It is meant for release your project into android file format when you are ready to distribute it.
I took a screenshot for you to see:
If you are using studio on Windows and your windows username contains special symbols like '&' - RENAME YOUR USERNAME (and user folder)!
My Issue has been resolved by following answer here https://www.reddit.com/r/androiddev/comments/2pfm2e/android_studio_local_path_doesnt_exist/ .
Please find the main points as follows.
Assuming you are on a mac/linux machine. If on Windows, use "gradlew.bat" instead of "./gradlew":
1) Close Android Studio
2) Open command line to the root of your project (the location of gradlew)
3) Run "./gradlew clean" to clean your project
4) Run "./gradlew --stop" to kill off any remnant Android Studio gradle daemons which may be caching stuff
5) Run "./gradlew assembleDebug" to build your project anew. (I am assuming you are building a basic debug configuration. If not, feel free to run "assemble" with your custom configuration.) If there are any issues with the project, you will see them here.
6) Restart Android Studio and try building again.

Android studio offline installation

My windows XP development environment has no internet access. So I need to install Android Studio without internet connection. (Formerly I used 1-2 months IntelliJ IDEA 12 for android development)
The steps I made:
I downloaded studio 0.2.x installation files from developer site (http://developer.android.com/sdk/installing/studio.html).
I downloaded JDK and installed.
I already installed Android SDK package installer, downloaded API files and installed that files by using this package installer. (http://siddharthbarman.com/apd/)
I tried to create new project. I get "gradle" error. It seems like gradle is bundled inside studio but because of error exists, I downloaded gradle-1.6.zip from their website. (http://www.gradle.org/downloads) I added gradle\bin to my PATH environment variable.
Then I still get new errors that maven is missing. It seems like I need to download maven but I even don't know the version.
Can you write step by step that how many more programs / libraries should I download to get Hello world from Android studio and Android emulator ?
Note: I download files from a machine that has internet connection, copy them to flash disk and move to my development machine.
There is no need to download Maven. Android Studio only uses Gradle. However, the first time you build your project, you'd need to have a internet connection so that the Android Gradle plugin and all its dependencies are downloaded and cached on your local disk. With an active internet connection, do:
$ cd /path/to/project
$ /path/to/gradle assembleDebug
Once that works, then you shouldn't need an internet connection.
Android Studio will eventually support such an offline mode.
Android Studio 0.4.0 now includes support for offline:
http://tools.android.com/recent/androidstudio040released
"You can now open the Compiler > Gradle options and enable Offline mode, which will tell Gradle to ignore update-to-date checks"
It doesn't work offline for creating new projects, so this is what I do and it works 100% offline!
Download Gradle and setup Environment variables
Create/Load project in Eclipse
File > Export
Select 'Generate Gradle build files'
Select project
Open AndroidStudio or IntelliJ13
Import project
Select 'Create project from existing sources'
Done!
But I preferred to use 'android create project' command, then setup 'build.gradle' file manually.

ERROR: dump failed because no AndroidManifest.xml found

When I try to upload an application to Android Play store I get the following error:
ERROR: dump failed because no AndroidManifest.xml found
Steps that I took:
new HDD, install clean jre, jdk
download Android eclipse bundle - latest version today
make a new project, sample. simple hello world
sign it with the wizard, create a certificate etc.
try to upload it on the market...=ERROR!
I tried many combinations, different eclipse versions. Even to sign it manually. It doesn't work.
If I try to run aapt dump badging I get the same error.
Just write in the terminal
flutter clean
Just delete app.apk file from: /build/app/outputs/apk/app.apk.
Visual Studio will create a new correct app.apk file.
I dont know o 'why' of this.
I faced this problem using Visual Studio Code in a Flutter project and Im posting my solution because it can help others.
I just run 'Flutter Clean Project' and then I run the project.
All works again!
In my case the problem was with the filename: I accidentally (subconsciously) renamed it to .apk, when it should be .aab 🤦
following points are need to be taken care of while uploading file on
android market
"android:versionCode" attribute from AndroidManifest.xml is proper.
"android:versionName" attribute from AndroidManifest.xml is proper.
The package name is very unique,. Because all the apps on android market are separated by the package.
see all this is in place....
taken from while uploading file to android market error
I had this issue suddenly as well,
my solution was
flutter clean
flutter build apk
and it started working again
OPTION #1: Slow down an re-read every step. (Source).
Basic Setup for Signing.
Before you begin, make sure that the Keytool utility and Jarsigner
utility are available to the SDK build tools. Both of these tools are
available in the JDK. In most cases, you can tell the SDK build tools
how to find these utilities by setting your JAVA_HOME environment
variable so it references a suitable JDK. Alternatively, you can add
the JDK version of Keytool and Jarsigner to your PATH variable.
...
Eclipse Users
If you are developing in Eclipse/ADT (and have set up Keytool and
Jarsigner as described above in Basic Setup for Signing), signing in
debug mode is enabled by default. When you run or debug your
application, ADT signs the .apk file with the debug certificate, runs
zipalign on the package, then installs it on the selected emulator or
connected device. No specific action on your part is needed, provided
ADT has access to Keytool.
OPTION #2: Test the features required by your application with an unsigned '.apk'. (Source).
You can use the aapt tool, included in the Android SDK, to determine
how Google Play will filter your application, based on its declared
features and permissions. To do so, run aapt with the dump badging
command. This causes aapt to parse your application's manifest and
apply the same rules as used by Google Play to determine the features
that your application requires.
To use the tool, follow these steps:
First, build and export your application as an unsigned .apk. If you
are developing in Eclipse with ADT, right-click the project and select
Android Tools > Export Unsigned Application Package. Select a
destination filename and path and click OK. Next, locate the aapt
tool, if it is not already in your PATH. If you are using SDK Tools r8
or higher, you can find aapt in the /platform-tools/ directory.
Note: You must use the version of aapt that is provided for the latest
Platform-Tools component available. If you do not have the latest
Platform-Tools component, download it using the Android SDK Manager.
Run aapt using this syntax:
$ aapt dump badging <path_to_exported_.apk>
compile it & export the project under Linux (eclipse)
switch to InteliJ Studio (recommended)
It seems that from time to time there is a problem with eclipse under Windows 7,8.
flutter clean && flutter run
also works
I'm using VScode.
What happened:
After dart update, there was a permission error on flutter.bat
Solution:
Locate flutter.bat and give Full controll.
Open a cmd with Admin privileges, locate the folder that you are doing the development.
use 'FLutter clean' command (do not use vscode Terminal)
rerun app using 'Run without debug'
run flutter clean then flutter pub get. Then run your application, it should work
Error while run xamarin.uitest on using android sdk build tools 29.
Problem solved by changing android sdk build tools to 28.
I have same problem and solved by deleting all folders containing apk files in the location -
D:\FLUTTER\MY PROJECTS\SAMPLE\myapp\build\app\outputs.
if any folder is found access denied then force delete the folder or restart your system and try deleting the folder, then rebuild the app. It will work.
Go to the directory build/app/outputs/apk/debug , and the directory build/app/outputs/apk/flutter-apk . Erase the present files, once the compilation has run these files will rebuild and the error will disappear!

Categories

Resources