KjellConnelly / react-native-chartboost

React Native Module for running native Chartboost ads
1 stars 2 forks source link

Android Installation #3

Open alexfigliolia opened 6 years ago

alexfigliolia commented 6 years ago

Sorry to bother again, during an android installation it seams as though RNChartboostPackage cannot be found in either MainActivity or MainApplication

Error:(17, 24) error: cannot find symbol class RNChartboostPackage

In newer versions of react-native most of the logic and instantiation of external libraries happens in MainApplication, but I've tried to instantiate it both the new and old way without any luck. I hope you can help me out with this one!

KjellConnelly commented 6 years ago

Can you post what your MainActivity.java contents are? I’m not an expert with android, but I’ll see if there’s anything I can notice.

alexfigliolia commented 6 years ago

` package com.wordclouds;

import com.facebook.react.ReactActivity; import com.RNChartboost.RNChartboostPackage; import android.os.Bundle;

public class MainActivity extends ReactActivity {

/**
 * Returns the name of the main component registered from JavaScript.
 * This is used to schedule rendering of the component.
 */
@Override
protected String getMainComponentName() {
    return "wordClouds";
}

  @Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Chartboost.onCreate(this); RNChartboostPackage.ONCREATE(this, "5abba4b6a4dfc60bfb6a528f", "271eb22f56f1dc58ee5939f2163a6e7c97194508"); } @Override public void onStart() { super.onStart(); RNChartboostPackage.ONSTART(this); }

@Override public void onResume() { super.onResume(); RNChartboostPackage.ONRESUME(this); }

@Override public void onPause() { super.onPause(); RNChartboostPackage.ONPAUSE(this); }

@Override public void onStop() { super.onStop(); RNChartboostPackage.ONSTOP(this); }

@Override public void onDestroy() { super.onDestroy(); RNChartboostPackage.ONDESTROY(this); }

@Override public void onBackPressed() { if (RNChartboostPackage.ONBACKPRESSED()) return; else super.onBackPressed(); } } `

KjellConnelly commented 6 years ago

Did you do react-native link react-native-chartboost when you first started?

Btw I updated the docs just a bit to add a bit about adding stuff to your AndroidManifest.xml file. It won’t fix the ‘can’t find RNChartboostPackage’ part, but I thought I’d let you know.

alexfigliolia commented 6 years ago

I linked manually but, I made sure to hit every step. Maybe ill try it again using RN link. Thank you for that! It's a great module you've put together.

KjellConnelly commented 6 years ago

Thanks Alex :) you may want to look up that error on google. I think it may have something to do with one of the build tools not compiling the RNChartboost file.

alexfigliolia commented 6 years ago

I may have located the issue. In RNAdMobRewardedVideoAdModule.java, there appears to be a method missing "onRewardedVideoCompleted". The latest error is the following:

Error:(25, 8) error: RNAdMobRewardedVideoAdModule is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener

I am not sure how to implement the method, but it seems as though another module expects it to be invoked

KjellConnelly commented 6 years ago

Looks like you’re using react-native-admob as well. I haven’t used it before so I’m not sure if that error is related to this module.

alexfigliolia commented 6 years ago

Admob is running fairly well on android. Ill inited a new project and will try to link it again. Hopefully it works!

alexfigliolia commented 6 years ago

Im sorry for the inconvenience, but I still have not been able to use this library successfully on android. When building the application in Android studio, I constantly receive the error:

error: method does not override or implement a method from a supertype

(RNChartboostPackage.java line 23)

The library is linked properly as is the Chartboost SDK

Best regards,

Alex

KjellConnelly commented 6 years ago

Can you show me your code from:

android/settings.gradle

And

android/app/build.gradle

You can just paste the chartboost lines of code. Not all is necessary unless you want to.

KjellConnelly commented 6 years ago

Oh never mind. You edited the error in your last post...

One thing I noticed is that in your onCreate method, you call Chartboost.onCreate(this);

Remove that line as the RNChartboostPackage already does this when you call RNChartboostPackage.ONCREATE...

alexfigliolia commented 6 years ago

Unfortunately I've tried that without any luck. Do you happen to have the library working in an android app? If you could share your set up minus any app sensitive data that'd be awesome. I've been wrestling with this for a few almost a week

alexfigliolia commented 6 years ago

Hey @KjellConnelly I finally got up and running on android but am facing a new set of issues related to getting this package to work:

The first issue is that cacheInterstitial doesn't seem to be a method on RNChartboost. I can invoke it via javascript but it returns an undefined error related to the package.

The second is that if i try to invoke showInterstitial, a test add never shows up. The failedToLoadAd listener is invoked, but so are the events related to a user dismissing the ad even though it is never visible to them.

Best regards and thank you again for all your help,

Alex

KjellConnelly commented 6 years ago

Hey Alex,

Sorry about that. I didn’t fully test the android version. I guess I never got around to implementing the cache method. I’ll do that later today. I’m not sure why the test interstitial isn’t being shown though. My guess is that it has something to do with your chartboost setup on their website.

Are you making sure to use the appropriate appID and signature for your app? I know chartboost will have separate values for iOS, Google Play, and Amazon apps. So make sure you’re using the appropriate one.

Also, I never tested for an Amazon app, though eventually I will. Just tested on an Android Emulator with Google Play Services I believe.

Next, did you setup a campaign on their website correctly? It seems like every time I setup chartboost on iOS Native apps in the past, there’s always a little delay before the ads actually show. Maybe an hour or two. If you just setup your app on their website very recently, this may be the issue.

I’ll let you know when a new version with cacheInterstitial is available.

alexfigliolia commented 6 years ago

Thank you so much, Ill double check

KjellConnelly commented 6 years ago

Btw I’m guessing that the userDismissed listener is invoked as well due to how the Chartboost SDK is setup. Maybe it’s some sort of good callback area where the developer can resume the app which was paused when showInterstitial was first shown. Not sure on all the ins and outs of where these methods get called though.

alexfigliolia commented 6 years ago

Its strange behavior because the entire app freezes on android after these listeners are invoked!

KjellConnelly commented 6 years ago

@alexfigliolia Ok I added cacheInterstitial(location) and hasInterstitial(location, callback) for android. Let me know if your app keeps freezing when listeners are invoked or not.