diff --git a/apk/AndroidManifest.xml b/apk/AndroidManifest.xml index 55b2edc..db6e32b 100644 --- a/apk/AndroidManifest.xml +++ b/apk/AndroidManifest.xml @@ -1,15 +1,15 @@ + package="de.alexmahr.app1" + android:versionCode="1" + android:versionName="1.0"> - diff --git a/apk/Makefile b/apk/Makefile index 6b34c9c..f84db2f 100644 --- a/apk/Makefile +++ b/apk/Makefile @@ -7,8 +7,6 @@ GCC = $(TOOLCHAIN)/bin/aarch64-linux-android-gcc CXX_FLAGS = -march=armv8-a --sysroot=$(TOOLCHAIN)/sysroot -say_hello: - echo "this was a test $(PLATFORM)" all: build deploy @@ -19,13 +17,10 @@ all: build deploy deploy : adb install -r ./bin/hellojni.apk -build : ./bin/hellojni.apk +build : ./bin/app1.apk -#./bin/hellojni.apk : ./bin/aligned.apk -# j -# cp $< $@ -./bin/hellojni.apk : ./bin/signed.apk +./bin/app1.apk : ./bin/signed.apk $(ANDROID_HOME)/build-tools/$(ANDROID_VERSION)/zipalign -v -f 4 $< $@ $(ANDROID_HOME)/build-tools/$(ANDROID_VERSION)/apksigner sign --ks ToyKey.keystore --key-pass pass:armena --ks-pass pass:armena $@ @@ -38,7 +33,7 @@ build : ./bin/hellojni.apk -I $(ANDROID_HOME)/platforms/$(PLATFORM)/android.jar -F $@ ./bin # $(ANDROID_HOME)/build-tools/23.0.3/aapt add $@ lib/arm64-v8a/libhello.so -./bin/classes.dex : ./obj/com/example/hellojni/HelloJni.class +./bin/classes.dex : ./obj/de/alexmahr/app1/App1.class #$(ANDROID_HOME)/build-tools/$(ANDROID_VERSION)/d8 --dex --verbose --output=$@ ./obj $(ANDROID_HOME)/build-tools/$(ANDROID_VERSION)/d8 $(shell find obj -name '*.class') --lib $(ANDROID_HOME)/platforms/$(PLATFORM)/android.jar --output bin @@ -48,18 +43,18 @@ build : ./bin/hellojni.apk #./jni/%.o : ./jni/%.c # $(GCC) $(CXX_FLAGS) -fPIC -c $< -o $@ -./src/com/example/hellojni/R.java : $(shell find ./res -type f) +./src/de/alexmahr/app1/R.java : $(shell find ./res -type f) $(ANDROID_HOME)/build-tools/$(ANDROID_VERSION)/aapt package -v -f -m -S ./res -J ./src -M ./AndroidManifest.xml \ -I $(ANDROID_HOME)/platforms/$(PLATFORM)/android.jar -./obj/com/example/hellojni/HelloJni.class : ./src/com/example/hellojni/HelloJNI.java ./src/com/example/hellojni/R.java +./obj/de/alexmahr/app1/App1.class : ./src/de/alexmahr/app1/App1.java ./src/de/alexmahr/app1/R.java #$(JAVA_HOME)/bin/javac -source 7 -target 7 -d ./obj -classpath $(ANDROID_HOME)/platforms/$(PLATFORMgg)/android.jar -sourcepath ./src $< #javac -source 7 -target 7 -d ./obj -classpath $(ANDROID_HOME)/platforms/$(PLATFORM)/android.jar -sourcepath ./src $< javac -d ./obj -classpath $(ANDROID_HOME)/platforms/$(PLATFORM)/android.jar -sourcepath ./src $< ./ToyKey.keystore : #$(JAVA_HOME)/bin/keytool -genkeypair -validity 1000 -dname "CN=some company,O=Android,C=JPN" -keystore $@ - keytool -genkeypair -validity 1000 -dname "CN=some company,O=Android,C=JPN" -keystore $@ \ + keytool -genkeypair -validity 1000 -dname "CN=alexander,O=Android,C=JPN" -keystore $@ \ -storepass armena -keypass armena -alias helljniKey -keyalg RSA -v clean: diff --git a/apk/res/layout/main.xml b/apk/res/layout/main.xml index 611c794..187f165 100644 --- a/apk/res/layout/main.xml +++ b/apk/res/layout/main.xml @@ -7,7 +7,7 @@ diff --git a/apk/res/values/strings.xml b/apk/res/values/strings.xml index c526073..2a92b6c 100644 --- a/apk/res/values/strings.xml +++ b/apk/res/values/strings.xml @@ -1,4 +1,4 @@ - HelloJni + App1 diff --git a/apk/src/com/example/hellojni/R.java b/apk/src/com/example/hellojni/R.java deleted file mode 100644 index 1087387..0000000 --- a/apk/src/com/example/hellojni/R.java +++ /dev/null @@ -1,22 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.example.hellojni; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int ic_launcher=0x7f020000; - } - public static final class layout { - public static final int main=0x7f030000; - } - public static final class string { - public static final int app_name=0x7f040000; - } -} diff --git a/apk/src/de/alexmahr/app1/HelloJNI.java b/apk/src/de/alexmahr/app1/HelloJNI.java deleted file mode 100644 index a7c76b2..0000000 --- a/apk/src/de/alexmahr/app1/HelloJNI.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.example.hellojni; - -import android.util.Log; -import android.widget.TextView; -import android.app.Activity; -import android.os.Bundle; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.lang.Thread; -import java.util.concurrent.TimeUnit; -import android.text.method.ScrollingMovementMethod; - -class Threads1 implements Runnable { - - public String result = "alex"; - - public void run(){ - try{ - result = result.concat("step 2\n"); - URL url = new URL("https://alexmahr.de/word"); - result = result.concat("step 3\n"); - HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); - result = result.concat("step 4\n"); - BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); - result = result.concat("step 5\n"); - String inputLine; - StringBuffer response = new StringBuffer(); - result = result.concat("step 6\n"); - - while ((inputLine = in.readLine()) != null) { - result = result.concat("step 7\n"); - response.append(inputLine); - } - result = result.concat("step 8\n"); - in.close(); - result = result.concat("step 9\n"); - result = result.concat( "OK".concat(response.toString())); - urlConnection.disconnect(); - } catch (Exception e){ -// throw new RuntimeException(e); - } - } -} - - -public class HelloJNI extends Activity -{ - - @Override - public void onCreate(Bundle savedInstanceState) - { - try - { - super.onCreate(savedInstanceState); - //volatile String result = "initial"; - String result = "initial"; - TextView tv = new TextView(this); - tv.setMovementMethod(new ScrollingMovementMethod()); - Threads1 threads1 = new Threads1(); - Thread thread = new Thread(threads1); - thread.start(); - thread.join(); - - // Thread thread = new Thread(new Runnable() { - - // @Override - // public void run() { - // try { - // result = result.concat("step 2\n"); - // URL url = new URL("https://alexmahr.de/word"); - // result = result.concat("step 3\n"); - // HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); - // result = result.concat("step 4\n"); - // BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); - // result = result.concat("step 5\n"); - // String inputLine; - // StringBuffer response = new StringBuffer(); - // result = result.concat("step 6\n"); - - // while ((inputLine = in.readLine()) != null) { - // result = result.concat("step 7\n"); - // response.append(inputLine); - // } - // result = result.concat("step 8\n"); - // in.close(); - // result = result.concat("step 9\n"); - // result = result.concat( "OK".concat(response.toString())); - // urlConnection.disconnect(); - - - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } - // }); - // thread.start(); - // thread.join(); - tv.setText( result); - setContentView(tv); - try{ - // TimeUnit.SECONDS.sleep(1); - } catch (Exception e){ -// throw new RuntimeException(e); - } - tv.setText(result.concat(threads1.result)); - } catch (Exception e) { - throw new RuntimeException(e); - } - - } - - -}