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

Admob ad does not load in WebView+ #33

Open
nvd-ai opened this issue Nov 6, 2014 · 5 comments
Open

Admob ad does not load in WebView+ #33

nvd-ai opened this issue Nov 6, 2014 · 5 comments

Comments

@nvd-ai
Copy link

nvd-ai commented Nov 6, 2014

When I use Cordova AdMob plugin in an app created using cordova CLI or cocoonjs CLI without using WebView+, it loads just fine. When I add the WebView+ plugin, the Ad does not appear.

Reproduction steps:

cocoonjs create testad/ com.testad testad
cd testad
cocoonjs platform add android
cocoonjs plugin add com.ludei.webview.plus -d
cocoonjs plugin add com.google.cordova.admob

/*at this point I add my project to www/ which contains AdMob calls. The app's Admob Section:

if (AdMob) AdMob.createBanner({
    banner: ' ca-app-pub-xxxxxx'
});
*/

cocoonjs run android

Expected result: Ad loads at the bottom of the page.

Actual result: Ad is missing

Comment: If I skip the line that adds WebView+ plugin to the project, Ad appears on the page.

Configurations:
Cordova CLI 4.0.0
CordovaJS 3.6.4
CocoonJS 1.0.0-0.5.0
Android 4.4.2
Device: Nexus 7

What's missing/wrong?

@karliky
Copy link
Contributor

karliky commented Nov 17, 2014

The latest release (2.4.0) solves this problem, please try installing it:

$ cocoonjs plugin add com.ludei.webview.plus

@Actimator
Copy link

I installed WebView+ 2.4.0 and it is still not working, despite trying all the configurations that I could think of. Could you possibly provide the configuration and steps that lead to a working version? Thanks.

@rick4470
Copy link

Same goes here.. For me it no longer build when I use
cordova plugin add com.rjfun.cordova.plugin.admob
cocoonjs build android

The error that I am getting

[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:15: error: CordovaWebView is not public in org.apache.cordova; cannot be accessed from outside package
[CocoonJS]     [javac] import org.apache.cordova.CordovaWebView;
    [javac]                          ^
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:97: error: cannot find symbol
    [javac]     public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    [javac]                                                      ^
    [javac]   symbol:   class CordovaWebView
    [javac]   location: class AdMob
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:219: error: getRootView() in View is defined in an inaccessible class or interface
[CocoonJS]     [javac]                     ((ViewGroup) webView.getRootView()).addView(adViewLayout, params);
    [javac]                                         ^
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:411: error: getParent() in View is defined in an inaccessible class or interface
[CocoonJS]     [javac]                         ViewGroup parentView = (ViewGroup) webView.getParent();
    [javac]                                                                   ^
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:468: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl(String.format(
    [javac]                    ^
    [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
    [javac]       (actual and formal argument lists differ in length)
    [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:475: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl("javascript:cordova.fireDocumentEvent('onLeaveToAd');");
    [javac]                    ^
    [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
    [javac]       (actual and formal argument lists differ in length)
    [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
[CocoonJS]     [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:483: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl("javascript:cordova.fireDocumentEvent('onReceiveAd');");
    [javac]                    ^
    [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
[CocoonJS]     [javac]       (actual and formal argument lists differ in length)
    [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
[CocoonJS] 
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:488: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl("javascript:cordova.fireDocumentEvent('onPresentAd');");
    [javac]                    ^
[CocoonJS]     [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS] 
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:493: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl("javascript:cordova.fireDocumentEvent('onDismissAd');");
    [javac]                    ^
    [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
[CocoonJS]     [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:502: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl("javascript:cordova.fireDocumentEvent('onReceiveInterstitialAd');");
    [javac]                    ^
    [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:511: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl("javascript:cordova.fireDocumentEvent('onPresentInterstitialAd');");
    [javac]                    ^
    [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS] 
    [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
[CocoonJS]     [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac] /Users/rick/Desktop/HackersHandBook/platforms/android/src/com/rjfun/cordova/plugin/AdMob.java:516: error: no suitable method found for loadUrl(String)
[CocoonJS]     [javac]             webView.loadUrl("javascript:cordova.fireDocumentEvent('onDismissInterstitialAd');");
    [javac]                    ^
[CocoonJS]     [javac]     method WebView.loadUrl(String,Map<String,String>) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac]     method CordovaWebView.loadUrl(String,int) is not applicable
    [javac]       (actual and formal argument lists differ in length)
[CocoonJS]     [javac] 12 errors
[CocoonJS]     [javac] 3 warnings

BUILD FAILED
/Applications/Android Studio.app/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Applications/Android Studio.app/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 1 second



/Users/rick/Desktop/HackersHandBook/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: ant with args: debug,-f,/Users/rick/Desktop/HackersHandBook/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen

[CocoonJS] ERROR building one of the platforms: Error: /Users/rick/Desktop/HackersHandBook/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/rick/Desktop/HackersHandBook/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

@nvd-ai
Copy link
Author

nvd-ai commented Mar 17, 2015

I just tried with the recent version of Cocoonjs (1.0.0-0.9.0) and it still does not load Admob ads. Any ideas?

@rick4470
Copy link

From the errors that I am getting it looks like we need to refactor a class.

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

4 participants