floatinghotpot / cordova-plugin-facebookads

Cordova/PhoneGap plugin for Facebook Audience Network Ads
64 stars 71 forks source link

Failed to build for android #102

Open lolaswift opened 5 years ago

lolaswift commented 5 years ago

FacebookAdPlugin.java:28: error: import requires canonical name for Image

ElieSauveterre commented 5 years ago

Same error since yesterday (2018-06-12).

`Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon (subsequent builds will be faster) publishNonDefault is deprecated and has no effect anymore. All variants are now published. Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead. The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. at build_dmzionmq5j4oq3q006j4dla7c.run(/myApp/platforms/android/app/build.gradle:148) :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preReleaseBuild UP-TO-DATE :CordovaLib:compileReleaseAidl :CordovaLib:compileReleaseRenderscript :CordovaLib:checkReleaseManifest :CordovaLib:generateReleaseBuildConfig :CordovaLib:prepareLintJar :CordovaLib:generateReleaseResValues :CordovaLib:generateReleaseResources :CordovaLib:packageReleaseResources :CordovaLib:platformAttrExtractor :CordovaLib:processReleaseManifest :CordovaLib:javaPreCompileRelease :CordovaLib:processReleaseJavaRes NO-SOURCE :app:preBuild UP-TO-DATE :app:preReleaseBuild Download https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml Download https://jcenter.bintray.com/com/facebook/android/audience-network-sdk/maven-metadata.xml Download https://jcenter.bintray.com/com/facebook/android/audience-network-sdk/4.99.0/audience-network-sdk-4.99.0.pom Download https://repo1.maven.org/maven2/com/facebook/android/audience-network-sdk/maven-metadata.xml Download https://jcenter.bintray.com/com/android/support/support-compat/maven-metadata.xml Download https://jcenter.bintray.com/com/android/support/support-media-compat/maven-metadata.xml Download https://jcenter.bintray.com/com/android/support/support-core-utils/maven-metadata.xml Download https://jcenter.bintray.com/com/facebook/android/audience-network-sdk/4.99.0/audience-network-sdk-4.99.0.aar :app:compileReleaseAidl :CordovaLib:packageReleaseRenderscript NO-SOURCE :app:compileReleaseRenderscript :app:checkReleaseManifest :app:generateReleaseBuildConfig :app:prepareLintJar :app:generateReleaseResValues :app:generateReleaseResources :app:mergeReleaseResources :app:createReleaseCompatibleScreenManifests :app:processReleaseManifest :app:splitsDiscoveryTaskRelease :app:compileReleaseNdk NO-SOURCE :CordovaLib:mergeReleaseShaders :CordovaLib:compileReleaseShaders :CordovaLib:generateReleaseAssets :CordovaLib:mergeReleaseAssets :app:mergeReleaseShaders :app:compileReleaseShaders :app:generateReleaseAssets :app:mergeReleaseAssets :CordovaLib:compileReleaseNdk NO-SOURCE :CordovaLib:mergeReleaseJniLibFolders :CordovaLib:transformNativeLibsWithMergeJniLibsForRelease :CordovaLib:transformNativeLibsWithIntermediateJniLibsForRelease :app:mergeReleaseJniLibFolders :app:processReleaseJavaRes NO-SOURCE :CordovaLib:processReleaseResources :CordovaLib:generateReleaseSources :CordovaLib:compileReleaseJavaWithJavacNote: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease :app:processReleaseResources :app:generateReleaseSources :app:javaPreCompileRelease :app:compileReleaseJavaWithJavac/myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:28: error: import requires canonical name for Image import com.facebook.ads.NativeAd.Image; ^ /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:29: error: import requires canonical name for Rating import com.facebook.ads.NativeAd.Rating; ^ /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:223: error: incompatible types: cannot be converted to NativeAdListener unit.ad.setAdListener(new AdListener(){ ^ /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:260: error: cannot find symbol String titleForAd = unit.ad.getAdTitle(); ^ symbol: method getAdTitle() location: variable ad of type NativeAd /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:265: error: cannot find symbol String textForAdBody = unit.ad.getAdBody(); ^ symbol: method getAdBody() location: variable ad of type NativeAd /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:286: error: cannot find symbol coverInfo.put("url", coverImage.getUrl()); ^ symbol: method getUrl() location: variable coverImage of type Image /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:293: error: cannot find symbol iconInfo.put("url", iconForAd.getUrl()); ^ symbol: method getUrl() location: variable iconForAd of type Image /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:299: error: cannot find symbol adchoiceInfo.put("url", adChoiceIcon.getUrl()); ^ symbol: method getUrl() location: variable adChoiceIcon of type Image /myApp/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:319: error: no suitable method found for registerViewForInteraction(View) unit.ad.registerViewForInteraction(unit.tracking); ^ method NativeAd.registerViewForInteraction(View,MediaView) is not applicable (actual and formal argument lists differ in length) method NativeAd.registerViewForInteraction(View,MediaView,AdIconView) is not applicable (actual and formal argument lists differ in length) method NativeAd.registerViewForInteraction(View,MediaView,List) is not applicable (actual and formal argument lists differ in length) method NativeAd.registerViewForInteraction(View,MediaView,AdIconView,List) is not applicable (actual and formal argument lists differ in length) Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 9 errors FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 28s `

jstncno commented 5 years ago

I'm getting the exact same error. Been at it for hours but still no luck

jstncno commented 5 years ago

Error log:

:app:compileDebugJavaWithJavac
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:28: error: import requires canonical name for Image

import com.facebook.ads.NativeAd.Image;
                                ^
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:29: error: import requires canonical name for Rating
import com.facebook.ads.NativeAd.Rating;
                                ^
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:212: error: incompatible types: <anonymous AdListener> cannot be converted to NativeAdListener

                unit.ad.setAdListener(new AdListener(){
                                      ^
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:249: error: cannot find symbol
                    String titleForAd = unit.ad.getAdTitle();
                                               ^
  symbol:   method getAdTitle()
  location: variable ad of type NativeAd
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:254: error: cannot find symbol
                    String textForAdBody = unit.ad.getAdBody();
                                                  ^
  symbol:   method getAdBody()
  location: variable ad of type NativeAd
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:275: error: cannot find symbol
                        coverInfo.put("url", coverImage.getUrl());
                                                       ^
  symbol:   method getUrl()
  location: variable coverImage of type Image
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:282: error: cannot find symbol
                        iconInfo.put("url", iconForAd.getUrl());
                                                     ^
  symbol:   method getUrl()
  location: variable iconForAd of type Image
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:296: error: no suitable method found for registerViewForInteraction(View)

                  unit.ad.registerViewForInteraction(unit.tracking);
                         ^
    method NativeAd.registerViewForInteraction(View,MediaView) is not applicable
      (actual and formal argument lists differ in length)
    method NativeAd.registerViewForInteraction(View,MediaView,AdIconView) is not applicable
      (actual and formal argument lists differ in length)
    method NativeAd.registerViewForInteraction(View,MediaView,List<View>) is not applicable
      (actual and formal argument lists differ in length)

    method NativeAd.registerViewForInteraction(View,MediaView,AdIconView,List<View>) is not applicable
      (actual and formal argument lists differ in length)
Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.
Note: /app/platforms/android/app/src/main/java/com/initialxy/cordova/themeablebrowser/ThemeableBrowser.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
8 errors

 FAILED

FAILURE:
Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
27 actionable tasks: 3 executed, 24 up-to-date
(node:19267) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /app/platforms/android/gradlew: Command failed with exit code 1 Error output:
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:28: error: import requires canonical name for Image
import com.facebook.ads.NativeAd.Image;
                                ^
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:29: error: import requires canonical name for Rating
import com.facebook.ads.NativeAd.Rating;
                                ^
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:212: error: incompatible types: <anonymous AdListener> cannot be converted to NativeAdListener
                unit.ad.setAdListener(new AdListener(){
                                      ^
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:249: error: cannot find symbol
                    String titleForAd = unit.ad.getAdTitle();
                                               ^
  symbol:   method getAdTitle()
  location: variable ad of type NativeAd
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:254: error: cannot find symbol
                    String textForAdBody = unit.ad.getAdBody();
                                                  ^
  symbol:   method getAdBody()
  location: variable ad of type NativeAd
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:275: error: cannot find symbol
                        coverInfo.put("url", coverImage.getUrl());
                                                       ^
  symbol:   method getUrl()
  location: variable coverImage of type Image
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:282: error: cannot find symbol
                        iconInfo.put("url", iconForAd.getUrl());
                                                     ^
  symbol:   method getUrl()
  location: variable iconForAd of type Image
/app/platforms/android/app/src/main/java/com/rjfun/cordova/facebookads/FacebookAdPlugin.java:296: error: no suitable method found for registerViewForInteraction(View)
                  unit.ad.registerViewForInteraction(unit.tracking);
                         ^
    method NativeAd.registerViewForInteraction(View,MediaView) is not applicable
      (actual and formal argument lists differ in length)
    method NativeAd.registerViewForInteraction(View,MediaView,AdIconView) is not applicable
      (actual and formal argument lists differ in length)
    method NativeAd.registerViewForInteraction(View,MediaView,List<View>) is not applicable
      (actual and formal argument lists differ in length)
    method NativeAd.registerViewForInteraction(View,MediaView,AdIconView,List<View>) is not applicable
      (actual and formal argument lists differ in length)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/platforms/android/app/src/main/java/com/initialxy/cordova/themeablebrowser/ThemeableBrowser.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
8 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
(node:19267) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
jstncno commented 5 years ago

Facebook has released a new version of the Audience Network Android SDK on June 12, 2018.

My workaround for now is to roll back to the previous version in my build.gradle file, from:

dependencies {
    ...
    compile "com.facebook.android:audience-network-sdk:4.+"
    ...
}

to:

dependencies {
    ...
    compile "com.facebook.android:audience-network-sdk:4.28.2"
    ...
}
vietnux commented 5 years ago

not done

ElieSauveterre commented 5 years ago

Thank you @earthican for finding the solution.

I made a fork of cordova-plugin-facebookads and of cordova-facebook-audnet-sdk which is the one who specify the version of the audience-network-sdk.

moresharecorp commented 5 years ago

help please, I'm getting the exact same error on PGB

mrbankim commented 5 years ago

Hi, Thank you @earthican and @ElieSauveterre . Once I updated the version code as you mentioned I am not getting any error but ad is not displaying. For me banner and interstitial ad should display. In log I am getting "ad display" but in device nothing is showing. Please let me know if you have any pointers.

Talking for Android.

Thank you.

blukis commented 5 years ago

I'm also seeing this suddenly fail to build on PGB with <plugin name="cordova-plugin-facebookads" version="4.23.2"/>. @floatinghotpot - if the workaround above is good, can it be incorporated and npm version updated for us PBG users?

halkoy commented 5 years ago

I have the same problem. I can not build android for this same reason. But I didn't understand the solution. Did you solve this? Please tell me solution clearly

halkoy commented 5 years ago

How to build this plugin with android? I can not solve the problem. The build error is the same that mentioned above. I need it urgently @floatinghotpot

ElieSauveterre commented 5 years ago

@halkoy You can use the fork I made => cordova-plugin-facebookads

Olofu commented 5 years ago

Does the the fork work? will it show facebook ads? @ElieSauveterre

ElieSauveterre commented 5 years ago

@Olofu It's working for me with native ads.

IvanLencina commented 5 years ago

@ElieSauveterre How can we use yours? I think I added it with ionic cordova plugin add ElieSauveterre/cordova-plugin-facebookads (i don't know if it is correct). Now my app runs but I'm getting this error: error: FacebookAds is not defined (I already added this line declare var FacebookAds: any; in my home.ts file).

ElieSauveterre commented 5 years ago

@IvanLencina You can install from a github url

ionic cordova plugin add https://github.com/ElieSauveterre/cordova-plugin-facebookads

You can also use a specific commit

ionic cordova plugin add https://github.com/ElieSauveterre/cordova-plugin-facebookads#d540140816f93ee37ebef8cf5b05e438db17588a

IvanLencina commented 5 years ago

@ElieSauveterre Thank you!

wearta commented 5 years ago

@IvanLencina is it work with you if yes ! how can i do it with phonegap build @ElieSauveterre

blukis commented 5 years ago

@wearta for phonegap build (and even cordova-proper?) replace this in your config.xml: <plugin name="cordova-plugin-facebookads" version="4.23.2"/> with this: <plugin name="cordova-plugin-facebookads" version="4.23.2" spec="https://github.com/ElieSauveterre/cordova-plugin-facebookads"/>

hodaifa82 commented 5 years ago

I have the same problem , when I tried your solution I got an error adds loaded to frequently I'm using phone gap

hodaifa82 commented 5 years ago

its giving ads loaded to frequently in banner any suggesion

hodaifa82 commented 5 years ago

@mrbankim did you solve it?

hodaifa82 commented 5 years ago

@mrbankim did you solve it?

blukis commented 5 years ago

@floatinghotpot this is still an issue, and won't build in PhoneGap build. Is there an ETA for a fix?

The above mentioned fork now has a app-startup-crash very similar to this one https://github.com/sunnycupertino/cordova-plugin-admob-simple/issues/38 - so I'm out of workarounds for this plugin, again. Thanks!

bartzy commented 5 years ago

@ElieSauveterre I'm still getting the same build errors with your version. Anything changed?

Vivek-abstract commented 5 years ago

Any fix for this? The modified plugin doesn't work either

hashmoody commented 5 years ago
      Any fix for this? The modified plugin doesn't work either

Did you find any fix Vivek?

Vivek-abstract commented 5 years ago

Not yet. The plugin doesn't build on Android. I just switched to using banner and interstitial ads using admobs

hashmoody commented 5 years ago
      Not yet. The plugin doesn't build on Android. I just switched to using banner and interstitial ads using admobs

Strange. Looks like a monopoly move from Google. No-other publisher plugins are able to work/perform good.

So the last resort, move to Admob.

zeeshan12312 commented 5 years ago

facebook now not supporting 4.28.2 if you have 4.28.2 sdk for new apps will not show ads. anyone have fix ?? @floatinghotpot please fix and @ElieSauveterre any update from your side ?

wearta commented 5 years ago

@zeeshan12312 yes you are right what we can do now to update sdk ??