Skip to content

Commit 4d05cab

Browse files
committed
Update na-subclass-jni
- updates gradle / AGP - updates icons - removes crates.io patches - updates Cargo.lock
1 parent 4d36cdb commit 4d05cab

29 files changed

Lines changed: 175 additions & 518 deletions

na-subclass-jni/Cargo.lock

Lines changed: 97 additions & 101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

na-subclass-jni/Cargo.toml

Lines changed: 2 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ edition = "2021"
88
[dependencies]
99
log = "0.4"
1010
android_logger = "0.11.0"
11-
android-activity = { version = "0.6", features = [ "native-activity" ] }
12-
#ndk-context = "0.1"
11+
android-activity = { version = "0.6", features = ["native-activity"] }
1312
ndk = "0.9"
1413
ndk-sys = "0.6"
1514
jni = "0.22"
@@ -19,176 +18,4 @@ serde_json = "1"
1918

2019
[lib]
2120
#name="na_subclass_jni"
22-
crate-type=["cdylib"]
23-
24-
25-
####################
26-
# cargo apk config #
27-
####################
28-
29-
[package.metadata.android]
30-
# Specifies the package property of the manifest.
31-
package = "com.foo.bar"
32-
33-
# Specifies the array of targets to build for.
34-
build_targets = [ "aarch64-linux-android" ]
35-
36-
# Path to your application's resources folder.
37-
# If not specified, resources will not be included in the APK.
38-
#resources = "path/to/resources_folder"
39-
40-
# Path to the folder containing your application's assets.
41-
# If not specified, assets will not be included in the APK.
42-
#assets = "path/to/assets_folder"
43-
44-
# Name for final APK file.
45-
# Defaults to package name.
46-
#apk_name = "myapp"
47-
48-
# Folder containing extra shared libraries intended to be dynamically loaded at runtime.
49-
# Files matching `libs_folder/${android_abi}/*.so` are added to the apk
50-
# according to the specified build_targets.
51-
#runtime_libs = "path/to/libs_folder"
52-
53-
# See https://developer.android.com/guide/topics/manifest/uses-sdk-element
54-
#
55-
# Defaults to a `min_sdk_version` of 23 and `target_sdk_version` of 30 (or lower if the detected NDK doesn't support this).
56-
[package.metadata.android.sdk]
57-
min_sdk_version = 28
58-
target_sdk_version = 31
59-
#max_sdk_version = 31
60-
61-
# See https://developer.android.com/guide/topics/manifest/uses-feature-element
62-
#
63-
# Note: there can be multiple .uses_feature entries.
64-
[[package.metadata.android.uses_feature]]
65-
name = "android.hardware.vulkan.level"
66-
required = true
67-
version = 1
68-
69-
# See https://developer.android.com/guide/topics/manifest/uses-permission-element
70-
#
71-
# Note: there can be multiple .uses_permission entries.
72-
#[[package.metadata.android.uses_permission]]
73-
#name = "android.permission.WRITE_EXTERNAL_STORAGE"
74-
#max_sdk_version = 18
75-
76-
# See https://developer.android.com/guide/topics/manifest/queries-element#provider
77-
#[[package.metadata.android.queries.provider]]
78-
#authorities = "org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker"
79-
# Note: The `name` attribute is normally not required for a queries provider, but is non-optional
80-
# as a workaround for aapt throwing errors about missing `android:name` attribute.
81-
# This will be made optional if/when cargo-apk migrates to aapt2.
82-
#name = "org.khronos.openxr"
83-
84-
# See https://developer.android.com/guide/topics/manifest/queries-element#intent
85-
#[[package.metadata.android.queries.intent]]
86-
#actions = ["android.intent.action.SEND"]
87-
88-
# See https://developer.android.com/guide/topics/manifest/queries-element#intent
89-
# Note: there can be several .data entries.
90-
#[[package.metadata.android.queries.intent.data]]
91-
#mime_type = "image/jpeg"
92-
93-
# See https://developer.android.com/guide/topics/manifest/queries-element#package
94-
#[[package.metadata.android.queries.package]]
95-
#name = "org.freedesktop.monado.openxr_runtime.in_process"
96-
97-
# See https://developer.android.com/guide/topics/manifest/application-element
98-
#[package.metadata.android.application]
99-
100-
# See https://developer.android.com/guide/topics/manifest/application-element#debug
101-
#
102-
# Defaults to false.
103-
#debuggable = false
104-
105-
# See https://developer.android.com/guide/topics/manifest/application-element#theme
106-
#
107-
# Example shows setting the theme of an application to fullscreen.
108-
#theme = "@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
109-
110-
# Virtual path your application's icon for any mipmap level.
111-
# If not specified, an icon will not be included in the APK.
112-
#icon = "@mipmap/ic_launcher"
113-
114-
# See https://developer.android.com/guide/topics/manifest/application-element#label
115-
#
116-
# Defaults to the compiled artifact's name.
117-
label = "Application Name"
118-
119-
# See https://developer.android.com/guide/topics/manifest/meta-data-element
120-
#
121-
# Note: there can be several .meta_data entries.
122-
# Note: the `resource` attribute is currently not supported.
123-
#[[package.metadata.android.application.meta_data]]
124-
#name = "com.samsung.android.vr.application.mode"
125-
#value = "vr_only"
126-
127-
# See https://developer.android.com/guide/topics/manifest/activity-element
128-
[package.metadata.android.application.activity]
129-
130-
# See https://developer.android.com/guide/topics/manifest/activity-element#nm
131-
#
132-
# The name of the class that implements the activity, a subclass of Activity
133-
#
134-
# Defaults to "android.app.NativeActivity"
135-
# name = "android.app.MyActivity"
136-
137-
# See https://developer.android.com/guide/topics/manifest/activity-element#config
138-
#
139-
# Defaults to "orientation|keyboardHidden|screenSize".
140-
#config_changes = "orientation"
141-
142-
# See https://developer.android.com/guide/topics/manifest/activity-element#label
143-
#
144-
# Defaults to the application's label.
145-
#label = "Activity Name"
146-
147-
# See https://developer.android.com/guide/topics/manifest/activity-element#lmode
148-
#
149-
# Defaults to "standard".
150-
#launch_mode = "singleTop"
151-
152-
# See https://developer.android.com/guide/topics/manifest/activity-element#screen
153-
#
154-
# Defaults to "unspecified".
155-
#orientation = "landscape"
156-
157-
# See https://developer.android.com/guide/topics/manifest/activity-element#exported
158-
#
159-
# Unset by default, or "true" when targeting Android >= 31 (S and up).
160-
#exported = "true"
161-
162-
# See https://developer.android.com/guide/topics/manifest/meta-data-element
163-
#
164-
# Note: there can be several .meta_data entries.
165-
# Note: the `resource` attribute is currently not supported.
166-
#[[package.metadata.android.application.activity.meta_data]]
167-
#name = "com.oculus.vr.focusaware"
168-
#value = "true"
169-
170-
# See https://developer.android.com/guide/topics/manifest/intent-filter-element
171-
#
172-
# Note: there can be several .intent_filter entries.
173-
#[[package.metadata.android.application.activity.intent_filter]]
174-
# See https://developer.android.com/guide/topics/manifest/action-element
175-
#actions = ["android.intent.action.VIEW", "android.intent.action.WEB_SEARCH"]
176-
# See https://developer.android.com/guide/topics/manifest/category-element
177-
#categories = ["android.intent.category.DEFAULT", "android.intent.category.BROWSABLE"]
178-
179-
# See https://developer.android.com/guide/topics/manifest/data-element
180-
#
181-
# Note: there can be several .data entries.
182-
# Note: not specifying an attribute excludes it from the final data specification.
183-
#[[package.metadata.android.application.activity.intent_filter.data]]
184-
#scheme = "https"
185-
#host = "github.com"
186-
#port = "8080"
187-
#path = "/rust-windowing/android-ndk-rs/tree/master/cargo-apk"
188-
#path_prefix = "/rust-windowing/"
189-
#mime_type = "image/jpeg"
190-
191-
[patch.crates-io]
192-
jni = { git = "https://github.com/jni-rs/jni-rs.git", branch = "release-0.22" }
193-
android-activity = { git = "https://github.com/rust-mobile/android-activity.git", branch = "rib/stack/jni-0.22" }
194-
#android-activity = { path = "../../../android-activity/jni-next/android-activity" }
21+
crate-type = ["cdylib"]

na-subclass-jni/app/build.gradle

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,37 @@ plugins {
33
}
44

55
android {
6-
ndkVersion "25.2.9519653"
7-
compileSdk 35
6+
compileSdk = 35
87

98
defaultConfig {
10-
applicationId "com.github.rust_mobile.nasubclassjni"
11-
minSdk 31
12-
targetSdk 35
13-
versionCode 1
14-
versionName "1.0"
9+
applicationId = "com.github.rust_mobile.nasubclassjni"
10+
minSdk = 31
11+
targetSdk = 35
12+
versionCode = 1
13+
versionName = "1.0"
1514
}
1615

1716
buildTypes {
1817
release {
19-
minifyEnabled false
18+
minifyEnabled = false
2019
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2120
}
2221
debug {
23-
minifyEnabled false
22+
minifyEnabled = false
2423
//packagingOptions {
2524
// doNotStrip '**/*.so'
2625
//}
2726
//debuggable true
2827
}
2928
}
3029
compileOptions {
31-
sourceCompatibility JavaVersion.VERSION_1_10
32-
targetCompatibility JavaVersion.VERSION_1_10
30+
sourceCompatibility JavaVersion.VERSION_17
31+
targetCompatibility JavaVersion.VERSION_17
3332
}
34-
namespace 'com.github.rust_mobile.nasubclassjni'
33+
namespace = 'com.github.rust_mobile.nasubclassjni'
3534
}
3635

3736
dependencies {
3837

39-
4038
}
4139

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.github.rust_mobile.nasubclassjni;
2+
3+
import android.app.NativeActivity;
4+
import android.os.Bundle;
5+
import android.util.Log;
6+
import android.content.Intent;
7+
8+
public class MainActivity extends NativeActivity {
9+
10+
private static final String TAG = "MainActivity";
11+
static {
12+
System.loadLibrary("na_subclass_jni");
13+
}
14+
15+
@Override
16+
protected void onCreate(Bundle savedInstanceState) {
17+
super.onCreate(savedInstanceState);
18+
Log.i(TAG, "onCreate");
19+
}
20+
21+
@Override
22+
protected void onNewIntent(Intent intent) {
23+
super.onNewIntent(intent);
24+
Log.i(TAG, "onNewIntent: " + intent.toString());
25+
notifyOnNewIntent(intent.toString());
26+
}
27+
28+
private static native void notifyOnNewIntent(String message);
29+
}

na-subclass-jni/app/src/main/res/drawable-v24/ic_launcher_foreground.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)