Create a Basic Android App without an IDE

Create a Basic Android App without an IDE

‘This tutorial walks you through building a basic Android app without an IDE.’

vaibhav kapoor

so much creative tips .Thanks for sharing this.

Bato D’Kalbo

Genius!!!

karan

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ‘:app:debugCompileClasspath’.
> Could not find com.android.support:appcompat-v7:253.1.
Searched in the following locations:
file:/home/karan/code/android/extras/m2repository/com/android/support/appcompat-v7/253.1/appcompat-v7-253.1.pom
file:/home/karan/code/android/extras/m2repository/com/android/support/appcompat-v7/253.1/appcompat-v7-253.1.jar
file:/home/karan/code/android/extras/google/m2repository/com/android/support/appcompat-v7/253.1/appcompat-v7-253.1.pom
file:/home/karan/code/android/extras/google/m2repository/com/android/support/appcompat-v7/253.1/appcompat-v7-253.1.jar
file:/home/karan/code/android/extras/android/m2repository/com/android/support/appcompat-v7/253.1/appcompat-v7-253.1.pom
file:/home/karan/code/android/extras/android/m2repository/com/android/support/appcompat-v7/253.1/appcompat-v7-253.1.jar
https://dl.google.com/dl/an…
https://dl.google.com/dl/an…
https://jcenter.bintray.com…
https://jcenter.bintray.com…
Required by:
project :app

karan

go to file app/build.gradle
search for :
appcompat-v7:253.1
replace with
appcompat-v7:25.3.1

enjoy.

Also go to - app/src/main/Androidmanifest.xml
search for
'@styles/AppTheme’
replace it to
@style/AppTheme’.

Brian Demers

Thanks @karan! I’ll get this post updated!

Iiridayn

Fantastic post. I’ve been wanting to build something in Android for ages, but the IDE always leaves me running screaming. Unfortunately, it might already be out of date - the environment variable I had to set was ANDROID_HOME (maybe a Windows vs Linux difference?), and more importantly the first build failed because licences weren’t accepted. The output links to http://d.android.com/r/stud… which forwards to https://developer.android.c… which has the comments:

> When you accept the license agreements using the SDK Manager, Android Studio creates a licenses directory inside the SDK home directory. This licenses directory is necessary for Gradle to auto-download missing packages.
> Note: Accepting the license agreements using the android command line tool does not create this licenses directory. You must first accept the agreements using the SDK Manager to be able to use this feature.

Can I get these licenses files appropriately without installing and running the SDK? (still a useful post if I can’t, many other things which are otherwise completely undocumented, etc).

Matt Raible

You could try creating the “licenses” directory manually. If that doesn’t work, I’d recommend downloading Android Studio.

Patricia Anaka

Thank you for writing this, it is very helpful! Unfortunately I can’t get past the very first compile. It says :

error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.

How do I fix it?

EDIT: Oh I see. I set my SDK to version 23 instead of 26 because I want to build for a device that only has Android 6.0. But those buttons are not in 23 :frowning:

Matt Raible

Hello Patricia,

Thanks for letting us know how you solved the problem!

Tom Hubbard

Great article! It can be overwhelming for a new Android developer to understand the thousands of options and menus in Android Studio. It is so helpful to know what the bare minimum is to get an app working from a text editor, and then you can build on that knowledge from there. Thank you!

jake

I am getting the following error:

Downloading https://services.gradle.org…

FAILURE: Build failed with an exception.

* Where:
Settings file ‘D:\AndroidProjectsCmdLine\gradletest\settings.gradle’

* What went wrong:
Could not compile settings file ‘D:\AndroidProjectsCmdLine\gradletest\settings.gradle’.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57

java.lang.IllegalArgumentException: Unsupported class file major version 57

This is followed by many other lines of text but I think this is the main error.

This is after initializing the folder with gradle and before adding any android code. This is what I get after running gradlew build. How can this be fixed?

Matt Raible

I believe this happens when you’re using a version of Java greater than 8. Can you confirm you’re using Java 8?

jake

I am using Java 13. I downloaded gradle 6.0 rc-1 and it seems the java problem at least is fixed in this version of gradle. I have a different related problem I hope you can help me with. When I do the gradlew build command I am getting this error (I have not yet added the java code nor attached an android phone to the computer):


> Configure project :app
Checking the license for package Android SDK Build-Tools 27.0.3 in C:\Users\HP\AppData\Local\Android\Sdk\licenses
Warning: License for package Android SDK Build-Tools 27.0.3 not accepted.
Checking the license for package Android SDK Platform 25 in C:\Users\HP\AppData\Local\Android\Sdk\licenses
Warning: License for package Android SDK Platform 25 not accepted.

FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring project ‘:app’.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-25 Android SDK Platform 25
build-tools;27.0.3 Android SDK Build-Tools 27.0.3
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/stud…

Using Android SDK: C:\Users\HP\AppData\Local\Android\Sdk

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/6.0…

BUILD FAILED in 1s

***
I am guessing because the target SDK in the sample code is android 25 but I don’t have that installed? In sdk/sources and sdk/platforms folder, I have a subfolder called android-29, so I guess this is the one I have installed. I am using the SDK location set up by android studio, but downloaded gradle 6.0 separately for command line compiling.

Anyway I can’t find SDK manager.exe in the sdk folder to install the other versions. I tried running sdkmanager.bat in sdk/tools/bin but it gives me the following error:

Exception in thread “main” java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
… 5 more

I am assuming my version is not compatible with Java 13. Android studio is too slow on my computer so I cannot use SDK manager through android studio either. Is there any way to launch sdk manager without using android studio so that I can download the required sdk packages? Do you think it’s worth downgrading Java to 8 (or may be just 12)? I don’t know enough about this topic to know if downgrading java will make any difference, so I was looking for a more professional opinion.

Matt Raible

Can you try with Java 8 and see if it works? Every time I’ve done Android development, I’ve had to use Java 8. Newer versions don’t work.

jake

I’m trying to download jdk 8, I’m not sure if it’s my internet or if they deliberately made it more difficult to download the older versions, but the download is real slow (showing estimated download time of hours, while I had downloaded jdk 13 in a couple of minutes just a few ago). I am also having a look at openJDk here (https://github.com/ojdkbuil…. Is this same as Oracle’s jdk? Can I expect android programs to compile seamlessly using open jdk, or should I expect there to be other specific configurations needed, if I use open jdk 8 instead?

Matt Raible

I believe OpenJDK 8 will work with Android. I used SDKMAN! this morning to install and run an Ionic app on Android and it worked just fine. https://sdkman.io/

Command:

sdk install java 8.0.232.hs-adpt

jake

I managed to get your sample code to compile. Thanks for the helpful post. I hope you do other command line tutorials like command line debugging (if it’s even possible in android) and using ndk

SFWP EXPERTS

There are some very good points. Which I like most. So I have decided to share it with my friends.

https://bit.ly/2luLMM2

Nury Garryyev

Is it possible to create a mobile app with a hosted login page without redirecting it to the Okta login page?
If yes, do you have a tutorial or documentation that will help to implement the mobile app with Okta hosted login page?