Skip to content

Commit

Permalink
Fixed: Fix proguard removing JNI used methods for release builds
Browse files Browse the repository at this point in the history
```
Exception in createServerSocketNative():
java.lang.NoSuchMethodError: no non-static method "Lcom/termux/shared/jni/models/JniResult;.<init>(IILjava/lang/String;I)V"
	at com.termux.shared.net.socket.local.LocalSocketManager.createServerSocketNative(Native Method)
	at com.termux.shared.net.socket.local.LocalSocketManager.createServerSocket(LocalSocketManager.java:125)
	at com.termux.shared.net.socket.local.LocalServerSocket.start(LocalServerSocket.java:100)
	at com.termux.shared.net.socket.local.LocalSocketManager.start(LocalSocketManager.java:84)
	at com.termux.shared.shell.am.AmSocketServer.start(AmSocketServer.java:68)
	at com.termux.shared.termux.shell.am.TermuxAmSocketServer.start(TermuxAmSocketServer.java:101)
	at com.termux.shared.termux.shell.am.TermuxAmSocketServer.setupTermuxAmSocketServer(TermuxAmSocketServer.java:77)
	at com.termux.app.TermuxApplication.onCreate(TermuxApplication.java:53)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6719)
	at android.app.ActivityThread.access$1300(ActivityThread.java:237)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7664)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
```
  • Loading branch information
agnostic-apollo committed Apr 22, 2022
1 parent 53f26c9 commit 7f7d889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.termux.shared.jni.models;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;

import com.termux.shared.logger.Logger;
Expand All @@ -11,6 +12,7 @@
* https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html
* https://developer.android.com/training/articles/perf-jni
*/
@Keep
public class JniResult {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;

import com.termux.shared.android.ProcessUtils;
Expand All @@ -10,6 +11,7 @@
import com.termux.shared.markdown.MarkdownUtils;

/** The {@link PeerCred} of the {@link LocalClientSocket} containing info of client/peer. */
@Keep
public class PeerCred {

public static final String LOG_TAG = "PeerCred";
Expand Down

0 comments on commit 7f7d889

Please sign in to comment.