diff options
| author | Coffee <1395803-Matrixcoffee@users.noreply.gitlab.com> | 2020-06-17 17:45:30 +0000 |
|---|---|---|
| committer | Coffee <1395803-Matrixcoffee@users.noreply.gitlab.com> | 2020-06-17 17:45:30 +0000 |
| commit | aa9a276dcb94f92bbf9ef720efe24049fb89973b (patch) | |
| tree | 4934687ea85e4a74db84e3fcb65e6891f8c2f44e | |
Initial Commit
| -rw-r--r-- | AndroidManifest.xml | 15 | ||||
| -rw-r--r-- | Makefile | 48 | ||||
| -rw-r--r-- | res/layout/activity_main.xml | 13 | ||||
| -rw-r--r-- | src/coffee/source/helloworld/HelloWorld.java | 16 |
4 files changed, 92 insertions, 0 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..1d79277 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="coffee.source.helloworld" + versionCode="0" + versionName="0"> + <uses-sdk android:minSdkVersion="19"/> + <application android:label="Hello World"> + <activity android:name=".HelloWorld"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8072390 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +ANDROIDSDK=/usr/lib/android-sdk/build-tools/debian +PLATFORM=/usr/lib/android-sdk/platforms/android-23/android.jar +MINSDK=19 +APP=src/coffee/source/helloworld + +CLASSES=$(patsubst %.java,%.class,$(wildcard $(APP)/*.java)) + +# Resources: +# https://www.hanshq.net/command-line-android.html + +helloworld.apk: helloworld.aligned.apk keystore.jks + apksigner sign --ks keystore.jks --ks-key-alias androidkey --ks-pass pass:android --key-pass pass:android --out $@ $< + +keystore.jks: + keytool -genkeypair -keystore $@ -alias androidkey -validity 10000 -keyalg RSA -keysize 2048 -storepass android -keypass android + +helloworld.aligned.apk: helloworld.unsigned.apk + zipalign -f -p 4 $< $@ + +helloworld.unsigned.apk: dex/classes.dex AndroidManifest.xml + aapt package -f -v -F $@ -I $(PLATFORM) -M AndroidManifest.xml -S res dex + +dex/classes.dex: $(CLASSES) + [ -e dex ] || mkdir dex + $(ANDROIDSDK)/dx --dex --verbose --min-sdk-version=$(MINSDK) --output=$@ src + +$(APP)/HelloWorld.class: $(APP)/*.java $(APP)/R.java + javac -bootclasspath $(PLATFORM) -classpath src -source 1.7 -target 1.7 $^ + +$(APP)/R.java: AndroidManifest.xml res/* + aapt package -f -m -J src -S res -M AndroidManifest.xml -I $(PLATFORM) + +clean: + rm -vf $(APP)/R.java \ + $(APP)/*.class \ + *.unsigned.apk \ + *.aligned.apk \ + dex/*.dex + +distclean: clean + [ ! -d dex ] || rmdir dex + rm -vf *.apk + +squeaky-clean: distclean + @echo 'Warning! This will remove your signing keys!' + @echo 'You have 5 seconds to press CTRL-C' + @sleep 5 + rm -vf *.jks diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml new file mode 100644 index 0000000..2f67c50 --- /dev/null +++ b/res/layout/activity_main.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/my_text"/> +</LinearLayout> diff --git a/src/coffee/source/helloworld/HelloWorld.java b/src/coffee/source/helloworld/HelloWorld.java new file mode 100644 index 0000000..bf012e2 --- /dev/null +++ b/src/coffee/source/helloworld/HelloWorld.java @@ -0,0 +1,16 @@ +package coffee.source.helloworld; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +public class HelloWorld extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + TextView text = (TextView)findViewById(R.id.my_text); + text.setText("Hello, world!"); + } +} |
