Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 223
Registered: ‎04-26-2012
My Device: Z10
My Carrier: Vodafone

NoClassDefFoundError when InetAddress.getLocalHost on OS10.2.1.1925

Hi!

 

This is someting was not happening on previous versions, I have it working on 10.2.1.5xx and works fine on other Android devices.

This 10.2.1.1925 breaks when you want to do

 InetAddress.getLocalHost()

 

See this sample doing just this.

 

 

package com.example.testbuginetaddrt;

import java.net.InetAddress;
import java.net.UnknownHostException;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		new Thread(new Runnable() {
			public void run() {
				InetAddress i;
				try {
					i = InetAddress.getLocalHost();
					Log.d("KK", i.toString());
				} catch (UnknownHostException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}catch(ExceptionInInitializerError e){
					e.printStackTrace();
				}
			}
		}).start();
	}

}

 

Add inet permission:

 

<uses-permission android:name="android.permission.INTERNET" />

 

And here you got the logcat:

 

 

01-08 07:52:29.776: I/System.out(89088163): waiting for debugger to settle...
01-08 07:52:29.978: I/System.out(89088163): debugger has settled (1399)
01-08 07:52:30.112: D/libEGL(89088163): loaded egl-dlls
01-08 07:52:30.137: D/libEGL(89088163): loaded glesv1-dlls
01-08 07:52:30.140: D/libEGL(89088163): loaded glesv2-dlls
01-08 07:52:30.287: D/OpenGLRenderer(89088163): Enabling debug mode 0
01-08 07:53:00.438: W/dalvikvm(89088163): Exception Llibcore/io/ErrnoException; thrown while initializing Llibcore/io/GaiException;
01-08 07:53:00.439: I/dalvikvm(89088163): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 07:53:00.439: I/dalvikvm(89088163): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 07:53:00.439: W/dalvikvm(89088163): Could not resolve class ref'ed in exception catch list (class index 1671, exception Ljava/lang/NoClassDefFoundErrorSmiley Wink
01-08 07:53:02.088: W/dalvikvm(89088163): Exception thrown (Ljava/lang/ExceptionInInitializerErrorSmiley Wink while throwing internal exception (Ljava/lang/NoClassDefFoundErrorSmiley Wink
01-08 07:53:02.088: I/dalvikvm(89088163): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 07:53:02.088: I/dalvikvm(89088163): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 07:53:02.088: W/dalvikvm(89088163): Could not resolve class ref'ed in exception catch list (class index 1671, exception Ljava/lang/NoClassDefFoundErrorSmiley Wink
01-08 07:53:45.422: I/dalvikvm(89088163): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 07:53:45.422: W/dalvikvm(89088163): Could not resolve class ref'ed in exception catch list (class index 1671, exception Ljava/lang/NoClassDefFoundErrorSmiley Wink
01-08 07:53:45.423: W/dalvikvm(89088163): threadid=10: thread exiting with uncaught exception (group=b9c0ea08)
01-08 07:53:45.434: E/AndroidRuntime(89088163): FATAL EXCEPTION: Thread-240
01-08 07:53:45.434: E/AndroidRuntime(89088163): java.lang.NoClassDefFoundError: libcore/io/GaiException
01-08 07:53:45.434: E/AndroidRuntime(89088163):     at libcore.io.Posix.getaddrinfo(Native Method)
01-08 07:53:45.434: E/AndroidRuntime(89088163):     at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:59)
01-08 07:53:45.434: E/AndroidRuntime(89088163):     at java.net.InetAddress.lookupHostByName(InetAddress.java:422)
01-08 07:53:45.434: E/AndroidRuntime(89088163):     at java.net.InetAddress.getLocalHost(InetAddress.java:370)
01-08 07:53:45.434: E/AndroidRuntime(89088163):     at com.example.testbuginetaddrt.MainActivity$1.run(MainActivity.java:22)
01-08 07:53:45.434: E/AndroidRuntime(89088163):     at java.lang.Thread.run(Thread.java:856)

 

Any solution?

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Highlighted
Developer
Posts: 223
Registered: ‎04-26-2012
My Device: Z10
My Carrier: Vodafone

Re: NoClassDefFoundError when InetAddress.getLocalHost on OS10.2.1.1925

Any help on this?

 

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Developer
Posts: 223
Registered: ‎04-26-2012
My Device: Z10
My Carrier: Vodafone

Re: NoClassDefFoundError when InetAddress.getLocalHost on OS10.2.1.1925

So it's not only my app, I've tested ohers like Ghost Commander and crashes the same way;

 

Any kind of workaround?

 

01-08 11:01:49.333: W/dalvikvm(275243158): Exception Llibcore/io/ErrnoException; thrown while initializing Llibcore/io/GaiException;
01-08 11:01:49.333: I/dalvikvm(275243158): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 11:01:49.333: W/dalvikvm(275243158): Exception thrown (Ljava/lang/ExceptionInInitializerError;) while throwing internal exception (Ljava/lang/NoClassDefFoundError;)
01-08 11:01:49.334: I/dalvikvm(275243158): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 11:01:49.334: I/dalvikvm(275243158): Rejecting re-init on previously-failed class Llibcore/io/GaiException; v=0
01-08 11:01:49.334: W/dalvikvm(275243158): Could not resolve class ref'ed in exception catch list (class index 1671, exception Ljava/lang/NoClassDefFoundError;)
01-08 11:01:49.334: W/dalvikvm(275243158): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Ljcifs/netbios/NbtAddress;
01-08 11:01:49.334: W/dalvikvm(275243158): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Ljcifs/UniAddress;
01-08 11:01:49.334: W/dalvikvm(275243158): threadid=11: thread exiting with uncaught exception (group=b9c0ea08)
01-08 11:01:49.340: V/PhoneStatusBar(5230603): setLightsOn(true)
01-08 11:01:49.342: E/AndroidRuntime(275243158): FATAL EXCEPTION: SMBAdapter.ListEngine
01-08 11:01:49.342: E/AndroidRuntime(275243158): java.lang.ExceptionInInitializerError
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.smb.SmbFile.getFirstAddress(SmbFile.java:862)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.smb.SmbFile.getAddress(SmbFile.java:822)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.smb.SmbFile.getType(SmbFile.java:1297)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.smb.SmbFile.doEnum(SmbFile.java:1733)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.smb.SmbFile.listFiles(SmbFile.java:1715)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.smb.SmbFile.listFiles(SmbFile.java:1648)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at com.ghostsq.commander.samba.ListEngine.run(ListEngine.java:77)
01-08 11:01:49.342: E/AndroidRuntime(275243158): Caused by: java.lang.ExceptionInInitializerError
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.UniAddress.<clinit>(UniAddress.java:62)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	... 7 more
01-08 11:01:49.342: E/AndroidRuntime(275243158): Caused by: java.lang.NoClassDefFoundError: libcore/io/GaiException
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at libcore.io.Posix.getaddrinfo(Native Method)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:59)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at java.net.InetAddress.lookupHostByName(InetAddress.java:422)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at java.net.InetAddress.getLocalHost(InetAddress.java:370)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	at jcifs.netbios.NbtAddress.<clinit>(NbtAddress.java:187)
01-08 11:01:49.342: E/AndroidRuntime(275243158): 	... 8 more
01-08 11:01:49.351: W/ActivityManager(5091471):   Force finishing activity com.ghostsq.commander/.FileCommander

 

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords