Skip to content

Commit fe12a95

Browse files
fix error type 3 issue with ANR
1 parent 8a53097 commit fe12a95

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

android/nakama-sdk/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ android {
6666
"-DANDROID_STL=c++_shared",
6767
"-DINSIDE_GRADLE=ON", // this is picked up by our CMake to interpose VCPKG toolchain
6868
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
69+
"-DCMAKE_TOOLCHAIN_FILE=${project.rootDir}/../submodules/vcpkg/scripts/buildsystems/vcpkg.cmake",
6970
)
7071
targets("nakama-sdk")
7172
}
@@ -94,7 +95,7 @@ android {
9495
// This is a prefab-only AAR, remove all jniLibs , which are just stripped version
9596
// of what we already include in prefab
9697
packaging {
97-
jniLibs.excludes += ("**/*.so")
98+
// jniLibs.excludes += ("**/*.so")
9899
}
99100

100101
buildToolsVersion = "36.0.0"

integrationtests/android/src/main/java/com/heroiclabs/nakamatest/MainActivity.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@
77
public class MainActivity extends Activity {
88
@Override
99
protected void onCreate(final Bundle savedInstanceState) {
10-
// load sdk first so that it may initialize before the test application
11-
Log.i("libnakama-test MainActivity", "Loading libnakama...");
12-
System.loadLibrary("nakama-sdk");
13-
Log.i("libnakama-test MainActivity", "Loading libnakama-test...");
14-
System.loadLibrary("nakama-test");
10+
super.onCreate(savedInstanceState);
11+
12+
Log.i("libnakama-test MainActivity", "Starting tests in background thread...");
13+
14+
new Thread(new Runnable() {
15+
@Override
16+
public void run() {
17+
try {
18+
Log.i("libnakama-test MainActivity", "Loading libnakama...");
19+
System.loadLibrary("nakama-sdk");
20+
Log.i("libnakama-test MainActivity", "Loading libnakama-test...");
21+
System.loadLibrary("nakama-test");
22+
} catch (Exception e) {
23+
Log.e("libnakama-test MainActivity", "Failed to load libraries: " + e.getMessage());
24+
}
25+
}
26+
}).start();
1527
}
1628
}

integrationtests/android/test_android.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ PACKAGE="com.heroiclabs.nakamatest"
123123

124124
# --- Clear logcat and launch ---
125125
adb_cmd logcat -c
126-
echo "Launching $ACTIVITY..."
127-
adb_cmd shell am start -n "$ACTIVITY"
126+
echo "Launching $PACKAGE via monkey..."
127+
adb_cmd shell monkey -p "$PACKAGE" -c android.intent.category.LAUNCHER 1
128128

129129
# --- Monitor logcat for test results ---
130130
echo "Waiting for test results (timeout: ${TIMEOUT}s)..."
131131
echo "---"
132132

133133
logfile="logcat-output.tmp"
134134
> "$logfile"
135-
"$ADB" -s "$serial" logcat "nakama:V" "AndroidRuntime:E" "ActivityManager:E" "*:S" -v raw > "$logfile" 2>/dev/null &
135+
"$ADB" -s "$serial" logcat "libnakama-test:V" "nakama:V" "AndroidRuntime:E" "ActivityManager:E" "*:S" -v raw > "$logfile" 2>/dev/null &
136136
logcat_pid=$!
137137
trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT
138138

0 commit comments

Comments
 (0)