opentelecoms-org / lumicall

SIP and ENUM dialer for Android with ZRTP/SRTP encryption, SIP over TLS, ICE/TURN for NAT, G.729 and many other features
http://www.lumicall.org
Other
144 stars 88 forks source link

Android 5 - java.lang.NoSuchMethodError: no non-static method "Ljava/net/InetAddress;.<init>()V" #23

Open notoken opened 9 years ago

notoken commented 9 years ago

Hi All

I've been trying to run Lumicall on a Nexus 5 with Android 5.

Lumicall can register to the SIP server but can't make phone calls. The program crashes but stays active in the notification bar, it has to be killed by hand in order to stop it, one of the errors viewed using logcat is the following:

I/UserAgent(30478): Starting Async call setup phase I/UserAgent(30478): UA: begin ICE setup (outbound) W/linker (30478): libOSNetworkSystem.so has text relocations. This is wasting memory and prevents security hardening. Please fix. F/art (30478): art/runtime/thread.cc:1105] No pending exception expected: java.lang.NoSuchMethodError: no non-static method "Ljava/net/InetAddress;.()V" F/art (30478): art/runtime/thread.cc:1105] at void org.sipdroid.net.impl.OSNetworkSystem.oneTimeInitializationImpl(boolean) (OSNetworkSystem.java:-2) F/art (30478): art/runtime/thread.cc:1105] at void org.sipdroid.net.impl.OSNetworkSystem.oneTimeInitialization(boolean) (OSNetworkSystem.java:742) F/art (30478): art/runtime/thread.cc:1105] at void org.sipdroid.net.SipdroidSocket.() (SipdroidSocket.java:142) F/art (30478): art/runtime/thread.cc:1105] at void org.sipdroid.sipua.UserAgent.setupICE(org.zoolu.sip.address.NameAddress) (UserAgent.java:480) F/art (30478): art/runtime/thread.cc:1105] at boolean org.sipdroid.sipua.UserAgent.callAsync(java.lang.String, boolean) (UserAgent.java:663) F/art (30478): art/runtime/thread.cc:1105] at java.lang.Object org.sipdroid.sipua.UserAgent$1.doInBackground(java.lang.Object[]) (UserAgent.java:637) F/art (30478): art/runtime/thread.cc:1105] at java.lang.Object android.os.AsyncTask$2.call() (AsyncTask.java:288) F/art (30478): art/runtime/thread.cc:1105] at void java.util.concurrent.FutureTask.run() (FutureTask.java:237) F/art (30478): art/runtime/thread.cc:1105] at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1112) F/art (30478): art/runtime/thread.cc:1105] at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:587) F/art (30478): art/runtime/thread.cc:1105] at void java.lang.Thread.run() (Thread.java:818) F/art (30478): art/runtime/thread.cc:1105]

evilelectron commented 9 years ago

Issue is with the OSNetworkSystem.cpp jni file. InetAddress class changed in Android 4. Use this patch and make a new build.

Index: jni/OSNetworkSystem.cpp
===================================================================
--- jni/OSNetworkSystem.cpp (revision 683)
+++ jni/OSNetworkSystem.cpp (working copy)
@@ -1181,9 +1181,14 @@

     char useAdbNetworkingProperty[PROPERTY_VALUE_MAX];
     char adbConnectedProperty[PROPERTY_VALUE_MAX];
+    char sdkVersionStr[PROPERTY_VALUE_MAX];
+    int sdkVersion = 0;

     property_get("android.net.use-adb-networking", useAdbNetworkingProperty, "");
     property_get("adb.connected", adbConnectedProperty, "");
+    property_get("ro.build.version.sdk", sdkVersionStr, "0");
+    
+    sdkVersion = atoi(sdkVersionStr);

     if (strlen((char *)useAdbNetworkingProperty) > 0
             && strlen((char *)adbConnectedProperty) > 0) {
@@ -1204,15 +1209,16 @@

     gCachedFields.iaddr_class = (jclass) env->NewGlobalRef(iaddrclass);

-    jmethodID iaddrclassinit = env->GetMethodID(iaddrclass, "<init>", "()V");
+    if (sdkVersion < 14) {
+        jmethodID iaddrclassinit = env->GetMethodID(iaddrclass, "<init>", "()V");

-    if (iaddrclassinit == NULL) {
-        jniThrowException(env, "java/lang/NoSuchMethodError", "InetAddress.<init>()");
-        return;
+        if (iaddrclassinit == NULL) {
+            jniThrowException(env, "java/lang/NoSuchMethodError", "InetAddress.<init>()");
+            return;
+        }
+
+        gCachedFields.iaddr_class_init = iaddrclassinit;
     }
-
-    gCachedFields.iaddr_class_init = iaddrclassinit;
-
     jmethodID iaddrgetbyaddress = env->GetStaticMethodID(iaddrclass,
             "getByAddress", "([B)Ljava/net/InetAddress;");
stasklev commented 8 years ago

Did somebody resolve this problem?

dpocock commented 8 years ago

The patch supplied was not sufficient but I have now made a more comprehensive fix for it. Please try v1.12.11 or later

https://github.com/opentelecoms-org/codecs/commit/0987f2b5e13e71206360a04a385e113ceba113d5

NoumanNawaz51 commented 2 years ago

Disabled minify and it's working fine now.