2

I tried to bind my project using this but however i failed to achieve so i am getting errors like noClassDefFoundFor NSObject

i also tried to add the older version ie this but here i am not able to link admob module to my ios module error which i an getting in this case is: no Configuration found for 'default'

i am using latest version of LibGDX.

log snippet:

ava.lang.NoClassDefFoundError: org/robovm/apple/foundation/NSObject$Handle
at org.robovm.pods.google.mobileads.GADRequest.<init>(GADRequest.java)
at com.blurpixel.arcpop.ViewController.createAndLoadBanner(ViewController.java)
at com.blurpixel.arcpop.ViewController.intializeAds(ViewController.java)
at com.blurpixel.arcpop.ViewController.showAds(ViewController.java)
at com.blurpixel.arcpop.Menu.show(Menu.java)
at com.badlogic.gdx.Game.setScreen(Game.java)
at com.blurpixel.arcpop.GameClass.create(GameClass.java)
at com.badlogic.gdx.backends.iosrobovm.IOSGraphics.draw(IOSGraphics.java)
at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.draw(IOSGraphics.java)
at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.$cb$drawRect$(IOSGraphics.java)
at org.robovm.apple.uikit.UIApplication.main(Native Method)
at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
at com.blurpixel.arcpop.IOSLauncher.main(IOSLauncher.java)

and what i am doing in my code is:

 adView = new GADBannerView(GADAdSize.SmartBannerPortrait());
    adView.setAdUnitID("xxxxxxxxxxxxxxx");
    adView.setRootViewController(UIApplication.getSharedApplication().getKeyWindow().getRootViewController());
    UIApplication.getSharedApplication().getKeyWindow().getRootViewController().getView().addSubview(adView);

    GADRequest request = new GADRequest();//this line is creating this error if i am commenting this line + the adview.loadAd line i am getting my game running without ads.
   request.setTestDevices(Arrays.asList(GADRequest.getSimulatorID()));
    adView.setDelegate(new GADBannerViewDelegateAdapter() {
        @Override
        public void didReceiveAd(GADBannerView view) {
            super.didReceiveAd(view);
        }
        @Override
        public void didFailToReceiveAd(GADBannerView view, GADRequestError error) {
            super.didFailToReceiveAd(view, error);
            System.out.println("Failed to recieve ");
        }
    });
    adView.loadRequest(request);

Gradle files:

ios gradle:

    sourceSets.main.java.srcDirs = ["src/"]
 sourceCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
ext {
    mainClassName = "com.blurpixel.arcpop.IOSLauncher"
}
launchIPhoneSimulator.dependsOn build
launchIPadSimulator.dependsOn build
launchIOSDevice.dependsOn build
createIPA.dependsOn build
eclipse.project {
    name = appName + "-ios"
    natures 'org.robovm.eclipse.RoboVMNature' 
}  
dependencies {

    compile "org.robovm:robopods-google-mobile-ads-ios:1.13.1-SNAPSHOT"
    compile "org.robovm:robopods-google-apis-ios:1.13.1-SNAPSHOT"
}

build.gradle:

    buildscript {
    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        jcenter()
    }


    dependencies {
        classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.2.0-SNAPSHOT'
    }
}
allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.2'
    ext {
        appName = "ArcPOP"
        gdxVersion = '1.9.2'
        roboVMVersion = '1.14.0'
        robopodsVersion = '1.13.1'
        box2DLightsVersion = '1.4'
        ashleyVersion = '1.7.0'
        aiVersion = '1.8.0'
        admobVersion = '9.0.1'
    }

    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}
project(":desktop") {
    apply plugin: "java"


    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
    }
}
project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")

        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"

        compile 'com.google.android.gms:play-services-ads:9.0.1'
        compile 'com.facebook.android:facebook-android-sdk:4.1.0'

    }
}
project(":ios") {
    apply plugin: "java"
    apply plugin: "robovm"


    dependencies {
        compile project(":core")
        compile "org.robovm:robovm-rt:$roboVMVersion"
        compile "org.robovm:robovm-cocoatouch:$roboVMVersion"
        compile "org.robovm:robopods-google-mobile-ads-ios:$robopodsVersion-SNAPSHOT"
        compile "org.robovm:robopods-google-apis-ios:$robopodsVersion-SNAPSHOT"
        compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
    }
}
project(":html") {
    apply plugin: "gwt"
    apply plugin: "war"
    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
    }
}
project(":core") {
    apply plugin: "java"


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
    }
}
tasks.eclipse.doLast {
    delete ".project"
}
dependencies {
}

Please Help and thanks in advance.

Ashwani
  • 1,294
  • 1
  • 11
  • 24
  • It seems you are not correctly linking robovm. But more information is needed to help you solve this issue. Perhaps with the robovm logs we can find a solution. – p.streef Jun 20 '16 at 14:53
  • Thanks for the reply.... dont know where i am making mistake i am using this example: https://github.com/robovm/robovm-robopods/issues/55 – Ashwani Jun 20 '16 at 17:41
  • There is a big difference between noClassDef for NSObject and NSObject$Handle If the answer to that issue does not solve your problem. Post your actual error logs. not just something that you might think will describe your problem. – p.streef Jun 21 '16 at 13:11
  • I have updated my question now it will be clear i guess – Ashwani Jun 21 '16 at 13:15
  • have you tried clearing cache like suggested in the link you posted? – p.streef Jun 21 '16 at 13:41
  • Yes i tried that but still i am having the same issue – Ashwani Jun 21 '16 at 13:42
  • The latest version of robovm uses a new version of Robovm. Perhaps this is the problem. Try an older version of robovm (1.9.0 for instance) and read up on it in this thread: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=22652&sid=3db716d53058e69076fcbd683f00c59b&start=10 – p.streef Jun 21 '16 at 13:59
  • I am not able to find it anywhere..please share a link if you have it – Ashwani Jun 21 '16 at 18:15
  • You should choose the version in your build.gradle file. If you post it here I can give you recommendations – p.streef Jun 22 '16 at 07:11
  • i have update my gradle file – Ashwani Jun 22 '16 at 10:08

1 Answers1

1

The problem is in your gradle files. First of all you are using the mobidevelop plugin with the official robovm. This might give problems.

then you are adding dependencies in 2 places. This should not do anything bad, but it is not needed and might cause problems if you change one of them.

Apply the following changes, rebuild gradle (dont forget to --refresh-dependencies) and rebuild your project. If it still fails clear cache again.

change:

classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.2.0-SNAPSHOT'      

to

classpath 'org.robovm:robovm-gradle-plugin:1.14.0'

and

robopodsVersion = '1.13.1'

to

robopodsVersion = '1.14.0'

might also need to change:

gdxVersion = '1.9.2'

to

gdxVersion = '1.9.0'

You might also need to remove the "-SNAPSHOT" from the robopod version. not 100% sure it they exist (and if you would want those)

remove:

dependencies {

    compile "org.robovm:robopods-google-mobile-ads-ios:1.13.1-SNAPSHOT"
    compile "org.robovm:robopods-google-apis-ios:1.13.1-SNAPSHOT"
}

from ios build.gradle (these area already defined in you main build.gradle)

p.streef
  • 3,652
  • 3
  • 26
  • 50
  • Still i am getting the same problem – Ashwani Jun 22 '16 at 13:53
  • i opened terminal and typed these comands `cd $HOME/.robovm/cache` then `rm -R ios` then crosschecked it by typing `ls` nothing was there..then clean and build my project. – Ashwani Jun 22 '16 at 18:08
  • you can clear the whole cache folder. not sure from the top of my head if there is anything else in there. Next could be to clear the gradle cache too. there might be something conflicting there (both in the home and project folder). Or it might work to just: gradlew clean build --refresh-dependencies. Just another thing, does the project run if you remove the google ads robopod (and code) altogether? – p.streef Jun 23 '16 at 06:49
  • no the program runs fine if i comment the request and load line from my code. Only the GADRequest is creating a problem, i am not able make a request. – Ashwani Jun 23 '16 at 09:02
  • Then I am at a loss. and the problem must be a combination between the ios sdk and robopod/robovm. I'm sorry, but I don't have a solution... A workaround would be to use heyzap robopod, which ads the possibility for mediation/other networks. You could also conciser not to use banners at all because they are usually (I'd say 99 out of 100 cases) not worth it in games. I would recommend looking into reward videos perhaps padded up with interstitials (could also be videos) – p.streef Jun 23 '16 at 11:36
  • I have added rewarded videos an game over but i need to display banner at menu screen..company policies they dont hear anything...:'( anyways thanks for your suggestion..i will post a solution as soon as i get one... – Ashwani Jun 23 '16 at 18:00
  • Heyzap also provides the banner implementation (with mediation). so it might still be useful. Good luck! – p.streef Jun 24 '16 at 06:59
  • Android version of game is already out...and it is using admob thats why i am left with no option, lets see i am digging more dipper, hope i get something, thanks for help..:) – Ashwani Jun 24 '16 at 07:17