commit 18f15741a7c5b562e62f0acd43c6dd4b4e77df37 Author: Jean-Marie 'Histausse' Mineau Date: Wed Oct 29 22:46:02 2025 +0100 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..85f61a8 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..aae860a --- /dev/null +++ b/build.sh @@ -0,0 +1,12 @@ +javac -classpath ~/Android/Sdk/platforms/android-34/android.jar java/classes/com/example/shadowing/MainActivity.java -d build/ +d8 --classpath ~/Android/Sdk/platforms/android-34/android.jar build/com/example/shadowing/MainActivity.class --output build/ +mkdir -p build/apk_files/ +cp build/classes.dex build/apk_files/ +~/Android/Sdk/build-tools/34.0.0/aapt package -v -f -M AndroidManifest.xml -I ~/Android/Sdk/platforms/android-34/android.jar -F build/app.apk build/apk_files/ +keytool -genkeypair -validity 1000 -dname "CN=SomeKey,O=SomeOne,C=FR" -keystore build/ToyKey.keystore -storepass 'P@ssw0rd!' -keypass 'P@ssw0rd!' -alias SignKey -keyalg RSA -v +~/Android/Sdk/build-tools/34.0.0/zipalign -f 4 build/app.apk build/app.aligned.apk +~/Android/Sdk/build-tools/34.0.0/apksigner sign -ks ToyKey.keystore --v2-signing-enabled true --in app.aligned.apk --out app.signed.apk --ks-pass 'pass:P@ssw0rd!' + +~/Android/Sdk/platform-tools/adb install app.signed.apk +~/Android/Sdk/platform-tools/adb shell am start -n com.example.shadowing/.MainActivity +~/Android/Sdk/platform-tools/adb uninstall com.example.shadowing diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..334606f --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + description = "APKs demonstrating class shadowing."; + inputs = { + nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; + flake-utils.url = github:numtide/flake-utils; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in rec { + + + devShells.default = pkgs.mkShell { + packages = [ pkgs.hello ]; + }; + }) + ; +} diff --git a/java/classes/com/example/shadowing/MainActivity.java b/java/classes/com/example/shadowing/MainActivity.java new file mode 100644 index 0000000..3df9c3d --- /dev/null +++ b/java/classes/com/example/shadowing/MainActivity.java @@ -0,0 +1,27 @@ +package com.example.shadowing; + +import android.app.Activity; +import android.os.Bundle; + +import android.widget.LinearLayout; +import android.widget.TextView; + +//import android.widget.RelativeLayout; +//import android.view.ViewGroup; +//import android.view.View; + +public class MainActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + LinearLayout ll = new LinearLayout(this); + ll.setOrientation(LinearLayout.VERTICAL); + ll.generateViewId(); + setContentView(ll); + TextView tw = new TextView(this); + tw.setText("Hello Void!"); + tw.generateViewId(); + ll.addView(tw); + } +}