Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: org/robovm/apple/foundation/NSObject$Handle #55

Closed
knepe opened this issue Nov 11, 2015 · 9 comments
Closed

Comments

@knepe
Copy link

knepe commented Nov 11, 2015

With latest snapshot 1.9.1 (and 1.9.0) I'm getting this error when loading ads:

java.lang.NoClassDefFoundError: org/robovm/apple/foundation/NSObject$Handle
    at org.robovm.pods.google.mobileads.GADRequest.<init>(GADRequest.java:50)
    at com.xxxx.IOSLauncher.initializeAds(IOSLauncher.java:62)
    at com.xxxx.IOSLauncher.didBecomeActive(IOSLauncher.java:92)
    at com.badlogic.gdx.backends.iosrobovm.IOSApplication$Delegate.$cb$applicationDidBecomeActive$(IOSApplication.java)
    at org.robovm.apple.uikit.UIApplication.main(Native Method)
    at org.robovm.apple.uikit.UIApplication.main(UIApplication.java:384)
    at com.xxxx.IOSLauncher.main(IOSLauncher.java:132)

This is my code which have worked with previous releases:

adview = new GADBannerView(GADAdSize.SmartBannerPortrait());                                                       
adview.setAdUnitID("xxxx"); //put your secret key here                           
UIViewController rootViewController = UIApplication.getSharedApplication().getKeyWindow().getRootViewController(); 
adview.setRootViewController(rootViewController);                                                                  
rootViewController.getView().addSubview(adview);                                                                   

GADRequest request = new GADRequest();                                                                             
// To test on your devices, add their UDIDs here:                                                                  
if(USE_TEST_DEVICES)                                                                                               
    request.setTestDevices(Arrays.asList(GADRequest.getSimulatorID()));                                            

adview.setDelegate(new GADBannerViewDelegateAdapter() {                                                            
    @Override                                                                                                      
    public void didReceiveAd(GADBannerView view) {                                                                 
        super.didReceiveAd(view);                                                                                  
        log.debug("didReceiveAd");                                                                                 
    }                                                                                                              

    @Override                                                                                                      
    public void didFailToReceiveAd(GADBannerView view,                                                             
                                   GADRequestError error) {                                                        
        super.didFailToReceiveAd(view, error);                                                                     
        log.debug("didFailToReceiveAd:" + error);                                                                  
    }                                                                                                              
});                                                                                                                

adview.loadRequest(request);

The line which it breaks on is:

GADRequest request = new GADRequest();

I'm using latest LibGDX 1.7.1 with RoboVM 1.9.0

@BlueRiverInteractive
Copy link
Contributor

NSObject$Handle has been introduced in 1.9.0. Make sure that you clear your robovm cache and build everything again. You can also try to use RoboVM 1.9.1-SNAPSHOT instead of stable.

@knepe
Copy link
Author

knepe commented Nov 14, 2015

Thanks! It worked when clearing the cache. I'm getting a new exception now though, and I have tried googling this, but cannot find anything. The exception is:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'When |allowsSignInWithWebView| is enabled, uiDelegate must either be a |UIViewController| or implement the |signIn:presentViewController:| and |signIn:dismissViewController:| methods from |GIDSignInUIDelegate|.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000114186f45 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000114982deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000114186e7d +[NSException raise:format:] + 205
    3   FFGame                              0x000000010bd63f93 +[GTLQueryPlus(Internal) queryForSettingsUpdateWithObject:settingId:] + 31826
    4   FFGame                              0x000000010bd60b90 +[GTLQueryPlus(Internal) queryForSettingsUpdateWithObject:settingId:] + 18511
    5   FFGame                              0x000000010beec172 -[GPGManager signInWithClientID:silently:withExtraScopes:] + 731
    6   FFGame                              0x000000010bbc4471 [J]org.robovm.pods.google.games.GPGManager.$m$signInWithClientID$silently$(Lorg/robovm/pods/google/games/GPGManager;Lorg/robovm/objc/Selector;Ljava/lang/String;Z)Z + 187
    7   FFGame                              0x000000010bbc16df [J]org.robovm.pods.google.games.GPGManager.signIn(Ljava/lang/String;Z)Z + 100
7   FFGame                              0x000000010bbc16df [J]org.robovm.pods.google.games.GPGManager.signIn(Ljava/lang/String;Z)Z + 100

My class implements "GIDSignInUIDelegate" and the methods "presentViewController" and "dismissViewController"... but they are empty and I don't know if I'm supposed to do anything in those? Sorry for being a noob, but if someone knows how to fix this I would be very grateful :)
And as I said I'm using LibGDX, so I guess my main class is not an UIViewController, but I think I can access the underlying UIViewController by calling

UIApplication.getSharedApplication().getKeyWindow().getRootViewController();

but I'm not sure how that helps me

EDIT: Got it to work now, after setting GIDSignIn.getSharedInstance().setUiDelegate(this); on didBecomeActive()

@ebbybeh
Copy link

ebbybeh commented Jan 6, 2016

This helped me out quite a bit but I am still not able to get the webview to show up upon signing in. It still switches to google+ or the google app, which I know will cause issues.
@knepe Is there is any additional info you could share regarding how you managed to get the webview to show?

Some info about my setup: My IOSLauncher class implements "GIDSignInUIDelegate" and I have "GIDSignIn.getSharedInstance().setUiDelegate(this);" placed in didFinishLaunching (Note: I tried putting this in a bunch of different location with no change in the results). I can sign in just fine, but that webview is not showing up.

@knepe
Copy link
Author

knepe commented Jan 12, 2016

I accidentely deleted my code I had (in a VM) so what I had working back then, is not working for me now. Though I don't get any errors, but I don't get any sign in options either :( I have an issue here about that, not sure if it's my code or something that has changed.

Anyway, you could try set this GIDSignIn.getSharedInstance().setAllowsSignInWithWebView(true);
in didFinishLaunching

@Ashwani270292
Copy link

I am still getting this error it tried clearing my caches and everything.
dont know where i am doing wrong.
i am a newbee and need some guidance regarding integrating admob in ios module of my libgdx project.
my code is same as @knepe.
error is
java.lang.NoClassDefFoundError: org/robovm/apple/foundation/NSObject$Handle
at org.robovm.pods.google.mobileads.GADRequest.(GADRequest.java)
at com.xxxxxxxx.IOSLauncher.intializeAds(IOSLauncher.java)

and i am using 2.1.0 version of robovm and 1.9 version of libgdx

@manuelbua
Copy link

I'm encountering the same problem as @Ashwani270292: for instance, i'm using mobidevelop's fork of robovm, that's it robovm-2.1.0, but since the version bump was made to avoid collisions i'm pretty confident that the bindings are the same as the original robovm-1.8. Quoting what @BlueRiverInteractive said:

NSObject$Handle has been introduced in 1.9.0. Make sure that you clear your robovm cache and build everything again. You can also try to use RoboVM 1.9.1-SNAPSHOT instead of stable.

So, are we out of luck? Is there something we can do to make it work?

@drewjosh
Copy link

drewjosh commented Jan 13, 2023

After updating to robovm version 2.3.18 (mobivm) and libgdx 1.10.0 I get the following error when starting the app. Same exception but for another class. Someone had that before? :

java.lang.NoClassDefFoundError: com.badlogic.gdx.backends.iosrobovm.IOSApplication$Delegate
	at java.lang.VMClassLoader.findClassInClasspathForLoader(Native Method)
	at java.lang.PathClassLoader.findClass(PathClassLoader.java:193)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:515)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:475)
ch.bfh.ti.bioapp: 11819

@FineTillYouCameAlong
Copy link

FineTillYouCameAlong commented Jun 4, 2023

After updating to robovm version 2.3.18 (mobivm) and libgdx 1.10.0 I get the following error when starting the app. Same exception but for another class. Someone had that before? :

I'm having the same problem on 2.3.19 and 1.11.0
Did you figure out how to fix it?

@alexanderobert
Copy link

After updating to robovm version 2.3.18 (mobivm) and libgdx 1.10.0 I get the following error when starting the app. Same exception but for another class. Someone had that before? :

I'm having the same problem on 2.3.19 and 1.11.0 Did you figure out how to fix it?

Hi, im having the same, Did you manage to solve the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants