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

Android build fails #130

Closed
fabioz23 opened this issue Jan 8, 2016 · 9 comments
Closed

Android build fails #130

fabioz23 opened this issue Jan 8, 2016 · 9 comments

Comments

@fabioz23
Copy link

fabioz23 commented Jan 8, 2016

Hi,

on my system:

Cordova CLI: 5.4.1
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.0
Ionic Version: 1.1.0
Ionic CLI Version: 1.7.12
Ionic App Lib Version: 0.6.5
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X El Capitan
Node Version: v4.2.3
Xcode version: Xcode 7.2 Build version 7C68

when i launch "ionic build android" I've this error:

...
...
:createXwalkCommandLineFileArmv7Debug
:generateArmv7DebugResValues UP-TO-DATE
:generateArmv7DebugResources UP-TO-DATE
:mergeArmv7DebugResources UP-TO-DATE
:processArmv7DebugManifest UP-TO-DATE
:processArmv7DebugResources
:generateArmv7DebugSources
:compileArmv7DebugJava/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:22: error: package com.google.android.gcm does not exist
import com.google.android.gcm.GCMBaseIntentService;
^
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:37: error: cannot find symbol
public class GCMIntentService extends GCMBaseIntentService implements PushConstants {
^
symbol: class GCMBaseIntentService
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:60: error: method does not override or implement a method from a supertype
@OverRide
^
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:78: error: method does not override or implement a method from a supertype
@OverRide
^
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:83: error: method does not override or implement a method from a supertype
@OverRide
^
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:110: error: cannot find symbol
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
^
symbol: method getSystemService(String)
location: class GCMIntentService
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:111: error: incompatible types: GCMIntentService cannot be converted to Context
String appName = getAppName(this);
^
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:116: error: no suitable constructor found for Intent(GCMIntentService,Class)
Intent notificationIntent = new Intent(this, PushHandlerActivity.class);
^
constructor Intent.Intent(String,Uri) is not applicable
(argument mismatch; GCMIntentService cannot be converted to String)
constructor Intent.Intent(Context,Class) is not applicable (argument mismatch; GCMIntentService cannot be converted to Context) /Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:122: error: incompatible types: GCMIntentService cannot be converted to Context PendingIntent contentIntent = PendingIntent.getActivity(this, requestCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); ^ /Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:227: error: cannot find symbol notification.sound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + getPackageName() + "/raw/blop"); ^ symbol: method getPackageName() location: class GCMIntentService /Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:242: error: no suitable constructor found for Intent(GCMIntentService,Class) Intent intent = new Intent(this, PushHandlerActivity.class); ^ constructor Intent.Intent(String,Uri) is not applicable (argument mismatch; GCMIntentService cannot be converted to String) constructor Intent.Intent(Context,Class) is not applicable
(argument mismatch; GCMIntentService cannot be converted to Context)
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:245: error: incompatible types: GCMIntentService cannot be converted to Context
PendingIntent pIntent = PendingIntent.getActivity(this, i, intent, PendingIntent.FLAG_UPDATE_CURRENT);
^
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:438: error: cannot find symbol
AssetManager assetManager = getAssets();
^
symbol: method getAssets()
location: class GCMIntentService
/Users/fabio/Downloads/zmNinja/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:518: error: method does not override or implement a method from a supertype
@OverRide
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use 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
14 errors
FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileArmv7DebugJava'.

    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.

BUILD FAILED

Total time: 8.361 secs

/Users/fabio/Downloads/zmNinja/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/fabio/Downloads/zmNinja/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/fabio/Downloads/zmNinja/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/fabio/Downloads/zmNinja/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/fabio/Downloads/zmNinja/platforms/android/cordova/build: Command failed with exit code 1

@pliablepixels
Copy link
Member

are you sure you did ionic state restore as per the directions? gcm is part of push plugin

@fabioz23
Copy link
Author

fabioz23 commented Jan 8, 2016

Yes sure, I launched following commands read on this wiki page:
https://github.com/pliablepixels/zmNinja/wiki/Running-zmNinja-from-Source

(curl and nodejs already installed on my pc)

sudo npm install -g cordova ionic
git clone https://github.com/pliablepixels/zmNinja.git
cd zmNinja
sudo npm install
sudo npm install -g gulp
ionic state restore
ionic build android

@pliablepixels
Copy link
Member

and you have the Android tool chain/SDK installed and validated it works? the instructions don't include android sdk and environment setup. If so, it's possible I missed gcm instructions --> I'll have to try on a new PC to figure out what I did

@fabioz23
Copy link
Author

fabioz23 commented Jan 8, 2016

yes, see the attachment.

and I have this var on bash:
ANDROID_SDK_HOME=/Users/fabio/Library/Android/sdk/

sdk1

sdk2

@pliablepixels
Copy link
Member

Can you install gcm package in extras and see?
http://stackoverflow.com/questions/12264761/add-gcm-jar-in-eclipse-ide-google-cloud-messaging

@fabioz23
Copy link
Author

fabioz23 commented Jan 8, 2016

ok, copying gcm.jar in zmNinja/platforms/android/libs/ the task complete with some notes:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

@pliablepixels
Copy link
Member

Those warnings can be ignored. So it looks like after you do ionic state restore, if you delete platforms/android and do 'ionic platform add android' then that process installs all the plugins including copying gcm.jar. I guess your method is fine too.

@fabioz23
Copy link
Author

fabioz23 commented Jan 8, 2016

Trying the steps you suggest I've the same error.
The gcm.jar wasn't copied automatically in neither case.

@pliablepixels
Copy link
Member

that's weird. I get gcm.jar copied each time. Anyway, glad you resolved it. Shall we close this issue?

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

2 participants