bitstadium / HockeySDK-Cordova

HockeyApp was retired and the SDKs are deprecated. Please use App Center instead.
https://github.com/microsoft/appcenter-sdk-cordova
Other
82 stars 73 forks source link

Android build failing in PhoneGap Build #44

Closed softwaredude closed 8 years ago

softwaredude commented 8 years ago

I'm using the Cordova plugin for HA (v2.2.2) very happily with iOS. Primarily because I'm on Windows, I'm using PhoneGap Build for my builds. The iOS build succeeds (and runs great - including the HA features - on devices), but the Android build fails. The beginning of the compilation in the build log shows:

    [javac] Compiling 22 source files to /project/bin/classes
    [javac] /project/src/com/zengularity/cordova/hockeyapp/HockeyApp.java:11: error: package net.hockeyapp.android does not exist
    [javac] import net.hockeyapp.android.CrashManager;

And, not surprisingly, there are quite a few more errors. At the end there's this:

    [javac] Note: Some input files use or override a deprecated API.

Is there a known current issue with Android, or should I be looking at how I've got config.xml set up for that platform? When I omit just the HA plugin for Android, the app builds and installs and runs just fine.

Thanks for the guidance.

lostintangent commented 8 years ago

@softwaredude If you build the Android project locally, do you get any build errors? We aren't aware of any issues with Android in general, but it's possible that there are extra considerations for PhoneGap Build that we need to investigate.

If you could run cordova platform ls and cordova plugin ls, and paste the output here, that would be awesome. The HockeyApp plugin requires Cordova Android 4.0.0+, so it's possible that you're project is using an older version of the Android plugin which is leading to build errors.

Thanks for reporting this and we'll try to get you unblocked soon.

softwaredude commented 8 years ago

Thanks for the reply, @lostintangent. I don't get any build errors locally. Here's the info you asked for:

cordova platform ls:

Installed platforms:
  android 5.1.1
Available platforms: 
  amazon-fireos ~3.6.3 (deprecated)
  blackberry10 ~3.8.0
  browser ~4.1.0
  firefoxos ~3.6.3
  webos ~3.7.0
  windows ~4.3.1
  wp8 ~3.8.2 (deprecated)

cordova plugin ls:

cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.3 "Console"
cordova-plugin-contacts 2.1.0 "Contacts"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-dialogs 1.2.1 "Notification"
cordova-plugin-globalization 1.0.3 "Globalization"
cordova-plugin-hockeyapp 2.2.2 "HockeyApp"
cordova-plugin-inappbrowser 1.4.0 "InAppBrowser"
cordova-plugin-network-information 1.2.1 "Network Information"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
cordova-plugin-x-toast 2.5.1 "Toast"
ionic-plugin-keyboard 2.0.1 "Keyboard"

To be honest, I was not building locally before I submitted the issue, but I've now done so. I've sideloaded the APK that I built and successfully used HockeyApp (submitting feedback) in the app, so I've proven that the local build works correctly. Uploading the identical package to PhoneGap Build and rebuilding for Android still fails with the same errors I reported above. (And, the iOS build still succeeds, and it still installs and runs fine on my iPhone.)

lostintangent commented 8 years ago

@softwaredude OK great, thanks so much for confirming that. We'll try to repro this with and see what's going on with PhoneGap Build. Stay tuned!

lostintangent commented 8 years ago

OK I figured out the issue. PhoneGap Build uses Ant to build Android apps by default. This plugin depends on Gradle, and therefore, you need to add special metadata to your config.xml file to let PhoneGap Build know that you want it to use Gradle instead of Ant.

Can you follow these instructions and see if that corrects the build error? I just tested it thoroughly and it seems to work great.

I updated our readme so that others can see the solution to this issue. Thanks so much for reporting it!

softwaredude commented 8 years ago

Works! Thanks for the quick turnaround on this guidance. Much appreciated!

lostintangent commented 8 years ago

Awesome, thanks for confirming this fix! Let us know if you run into any other issues.