WIP2 last mod index files
This commit is contained in:
parent
adaab4adfc
commit
7e72c319d7
6 changed files with 12 additions and 156 deletions
|
@ -1,15 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.hellojni"
|
||||
android:versionCode="3"
|
||||
android:versionName="3.0">
|
||||
package="de.alexmahr.app1"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="30"
|
||||
android:targetSdkVersion="33"/>
|
||||
<uses-permission android:name="android.permission.INTERNET">
|
||||
</uses-permission>
|
||||
<!-- android:maxSdkVersion="integer" /> -->
|
||||
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
||||
<activity android:name="HelloJNI"
|
||||
<activity android:name="de.alexmahr.app1.App1"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
|
|
17
apk/Makefile
17
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:
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World, HelloJni"
|
||||
android:text="aa"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">HelloJni</string>
|
||||
<string name="app_name">App1</string>
|
||||
</resources>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue