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

Failed to build for android #102

Open
lolaswift opened this issue Jun 13, 2018 · 31 comments
Open

Failed to build for android #102

lolaswift opened this issue Jun 13, 2018 · 31 comments

Comments

@lolaswift
Copy link

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

@ElieSauveterre
Copy link

ElieSauveterre commented Jun 13, 2018

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.

  • What went wrong:
    Execution failed for task ':app:compileReleaseJavaWithJavac'.

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 28s
`

@jstncno
Copy link

jstncno commented Jun 14, 2018

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

@jstncno
Copy link

jstncno commented Jun 14, 2018

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
Copy link

jstncno commented Jun 14, 2018

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
Copy link

vietnux commented Jun 14, 2018

not done

@ElieSauveterre
Copy link

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
Copy link

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

@mrbankim
Copy link

mrbankim commented Jun 22, 2018

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
Copy link

blukis commented Jun 25, 2018

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
Copy link

halkoy commented Jul 5, 2018

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
Copy link

halkoy commented Jul 7, 2018

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
Copy link

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

@Olofu
Copy link

Olofu commented Jul 8, 2018

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

@ElieSauveterre
Copy link

ElieSauveterre commented Jul 8, 2018

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

@IvanLencina
Copy link

@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
Copy link

@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
Copy link

@ElieSauveterre Thank you!

@wearta
Copy link

wearta commented Aug 4, 2018

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

@blukis
Copy link

blukis commented Aug 4, 2018

@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
Copy link

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

@hodaifa82
Copy link

its giving ads loaded to frequently in banner any suggesion

@hodaifa82
Copy link

@mrbankim did you solve it?

1 similar comment
@hodaifa82
Copy link

@mrbankim did you solve it?

@blukis
Copy link

blukis commented Oct 7, 2018

@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 sunnycupertino/cordova-plugin-admob-simple#38 - so I'm out of workarounds for this plugin, again. Thanks!

@bartzy
Copy link

bartzy commented Oct 20, 2018

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

@Vivek-abstract
Copy link

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

@hashmoody
Copy link

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

Did you find any fix Vivek?

@Vivek-abstract
Copy link

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

@hashmoody
Copy link

      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
Copy link

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
Copy link

wearta commented Feb 27, 2019

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

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