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

Building for Android is a quest #179

Closed
bramus opened this Issue Sep 29, 2015 · 12 comments

Comments

Projects
None yet
5 participants
@bramus

bramus commented Sep 29, 2015

I have Android SDK 23 and 24 installed. Adding this plugin and then building my app (powered by Ionic) via ionic build android does not work.

The build instruction spits out this error

Running: /Users/distiller/redacted-app/platforms/android/gradlew cdvBuildDebug -b /Users/distiller/redacted-app/platforms/android/build.gradle -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.android.support:support-v13:23+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v13/maven-metadata.xml
         https://repo1.maven.org/maven2/com/android/support/support-v13/
     Required by:
         :android:unspecified

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

BUILD FAILED

The required dependency is not found on Maven. When removing cordova.system.library.1=com.android.support:support-v13:23+ from platforms/android/project.properties (so that it does not longer look on Maven for said dependency) the build still fails, as the required classes are still not found.

:compileReleaseJava/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:18: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:220: error: package NotificationCompat does not exist
    private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName) {
                                                                ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:244: error: package NotificationCompat does not exist
    private void setNotificationCount(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                       ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:254: error: package NotificationCompat does not exist
    private void setNotificationVibration(Bundle extras, Boolean vibrateOption, NotificationCompat.Builder mBuilder) {
                                                                                                  ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:272: error: package NotificationCompat does not exist
    private void setNotificationMessage(int notId, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                    ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:369: error: package NotificationCompat does not exist
    private void setNotificationSound(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                        ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:384: error: package NotificationCompat does not exist
    private void setNotificationLedColor(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:403: error: package NotificationCompat does not exist
    private void setNotificationPriority(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:419: error: package NotificationCompat does not exist
    private void setNotificationLargeIcon(Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder) {
                                                                                                                    ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:448: error: package NotificationCompat does not exist
    private void setNotificationSmallIcon(Context context, Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder, String localIcon) {
                                                                                                                                     ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:466: error: package NotificationCompat does not exist
    private void setNotificationIconColor(String color, NotificationCompat.Builder mBuilder, String localIconColor) {
                                                                          ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:124: error: package NotificationCompat does not exist
        NotificationCompat.Builder mBuilder =
                          ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:125: error: package NotificationCompat does not exist
                new NotificationCompat.Builder(context)
                                      ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:290: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                  ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:290: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                                                                        ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:300: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                  ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:300: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                                ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:310: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                              ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:310: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                                                                                  ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:322: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                              ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:322: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                            ^
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:408: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
/Users/distiller/redacted-app/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:408: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                                                               ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
23 errors
 FAILED

Having Googled a bit around I've found some solutions hinting to install “Android Support Library", yet that already was the case. Another solution mentioned android-support-v13.jar, which contains the required classes.

I've found a Cordova Plugin that contains this .jar file: https://github.com/nnexai/cordova-plugin-android-support-v13. When installing said plugin (cordova plugin install https://github.com/nnexai/cordova-plugin-android-support-v13) – in addition to the removal of the line cordova.system.library.1=com.android.support:support-v13:23+ from project.properties – the build now works fine.

I was wondering: is it possible to not inject the cordova.system.library.1=com.android.support:support-v13:23+ requirement, and – instead – require https://github.com/nnexai/cordova-plugin-android-support-v13?

@macdonst macdonst added the docs label Sep 29, 2015

@bramus

This comment has been minimized.

Show comment
Hide comment
@bramus

bramus Sep 29, 2015

Exploring this repo a tad further it seems like android-support-v13.jar – at a given moment – was indeed included in this project, but then got replaced by a Maven requirement: 6b5bebb

bramus commented Sep 29, 2015

Exploring this repo a tad further it seems like android-support-v13.jar – at a given moment – was indeed included in this project, but then got replaced by a Maven requirement: 6b5bebb

@macdonst

This comment has been minimized.

Show comment
Hide comment
@macdonst

macdonst Sep 29, 2015

Member

@bramus Yes, I used to included the android-support-v13.jar file in the plugin but that is not the correct way to do things. If more than one plugin includes this jar you will get Dexopt errors while compiling since the jar was included more than once. If you go back through the plugins issues you will find this was a common complaint.

The proper way to include this jar as of Android Studio/Android 5/Gradle/Maven is via the framework tag. This gets around the multi jar problem and is the way Google is doing things going forward so I'm not going backwards. In fact I'll be removing gcm.jar and replacing it with another framework in the near future.

I'd rather not depend on an external plugin for this functionality as I'm not sure when they update their jar version. Instead I will document how to install the jar locally so your build will just work.

Member

macdonst commented Sep 29, 2015

@bramus Yes, I used to included the android-support-v13.jar file in the plugin but that is not the correct way to do things. If more than one plugin includes this jar you will get Dexopt errors while compiling since the jar was included more than once. If you go back through the plugins issues you will find this was a common complaint.

The proper way to include this jar as of Android Studio/Android 5/Gradle/Maven is via the framework tag. This gets around the multi jar problem and is the way Google is doing things going forward so I'm not going backwards. In fact I'll be removing gcm.jar and replacing it with another framework in the near future.

I'd rather not depend on an external plugin for this functionality as I'm not sure when they update their jar version. Instead I will document how to install the jar locally so your build will just work.

@macdonst

This comment has been minimized.

Show comment
Hide comment
Member

macdonst commented Sep 29, 2015

screenshot 2015-09-29 12 58 15

@bramus

This comment has been minimized.

Show comment
Hide comment
@bramus

bramus Sep 29, 2015

Hey Simon,

Thanks for the quick response.

I've checked and I had ”Android Support Library” already installed, yet things were still going wrong: the dependency could not be resolved.

Looking a bit further I found this interesting note on https://developer.android.com/tools/support-library/setup.html:

Note: If you're developing with Android Studio, select and install the Android Support Repository item instead.

When looking at the screenshot above you seem to also have this installed, yet I hadn't. Installing “Android Support Repository” (the latest: v20) eventually fixed it for me.

Regards,
B!

bramus commented Sep 29, 2015

Hey Simon,

Thanks for the quick response.

I've checked and I had ”Android Support Library” already installed, yet things were still going wrong: the dependency could not be resolved.

Looking a bit further I found this interesting note on https://developer.android.com/tools/support-library/setup.html:

Note: If you're developing with Android Studio, select and install the Android Support Repository item instead.

When looking at the screenshot above you seem to also have this installed, yet I hadn't. Installing “Android Support Repository” (the latest: v20) eventually fixed it for me.

Regards,
B!

@macdonst

This comment has been minimized.

Show comment
Hide comment
Member

macdonst commented Oct 1, 2015

screenshot 2015-10-01 14 37 18

@macdonst

This comment has been minimized.

Show comment
Hide comment
@macdonst

macdonst Oct 1, 2015

Member

@bramus thanks for the heads up, I just updated the README.

Member

macdonst commented Oct 1, 2015

@bramus thanks for the heads up, I just updated the README.

@bramus

This comment has been minimized.

Show comment
Hide comment

bramus commented Oct 1, 2015

👍

@mohitmayank

This comment has been minimized.

Show comment
Hide comment
@mohitmayank

mohitmayank Oct 16, 2015

Its still a quest (atleast for me)

build errors i am getting -

<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:18: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:220: error: package NotificationCompat does not exist
    private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName) {
                                                                ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:244: error: package NotificationCompat does not exist
    private void setNotificationCount(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                       ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:254: error: package NotificationCompat does not exist
    private void setNotificationVibration(Bundle extras, Boolean vibrateOption, NotificationCompat.Builder mBuilder) {
                                                                                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:272: error: package NotificationCompat does not exist
    private void setNotificationMessage(int notId, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                    ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:369: error: package NotificationCompat does not exist
    private void setNotificationSound(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                        ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:384: error: package NotificationCompat does not exist
    private void setNotificationLedColor(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:403: error: package NotificationCompat does not exist
    private void setNotificationPriority(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:419: error: package NotificationCompat does not exist
    private void setNotificationLargeIcon(Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder) {
                                                                                                                    ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:448: error: package NotificationCompat does not exist
    private void setNotificationSmallIcon(Context context, Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder, String localIcon) {
                                                                                                                                     ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:466: error: package NotificationCompat does not exist
    private void setNotificationIconColor(String color, NotificationCompat.Builder mBuilder, String localIconColor) {
                                                                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:124: error: package NotificationCompat does not exist
        NotificationCompat.Builder mBuilder =
                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:125: error: package NotificationCompat does not exist
                new NotificationCompat.Builder(context)
                                      ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:290: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:290: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                                                                        ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:300: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:300: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                                ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:310: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                              ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:310: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                                                                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:322: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                              ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:322: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                            ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:408: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:408: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                                                               ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
<cordova_root>/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:133: error: cannot access Fragment
        shareDialog = new ShareDialog(cordova.getActivity());
                      ^
  class file for android.support.v4.app.Fragment not found
Note: <cordova_root>/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
24 errors
:compileDebugJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJava'.
> 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: 7.62 secs

<cordova_root>/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: <cordova_root>/platforms/android/gradlew with args: cdvBuildDebug,-b,<cordova_root>/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: <cordova_root>/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: <cordova_root>/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I do have required files -

screenshot_2015-10-16_12-45-06

and here's my plugins -

<plugin name="cordova.plugin.googleplus" spec="https://github.com/EddyVerbruggen/cordova-plugin-googleplus"/>
<plugin name="cordova-plugin-whitelist" spec="^1.0.0"/>
<plugin name="cordova-plugin-customurlscheme" spec="^4.0.0">
    <variable name="URL_SCHEME" value="xxxxxx"/>
</plugin>
<plugin name="cordova-plugin-google-analytics" spec="^0.8.0"/>
<plugin name="cordova-plugin-dialogs" spec="^1.1.1"/>
<plugin name="cordova-plugin-statusbar" spec="^1.0.1"/>
<plugin name="cordova-plugin-facebook4" spec="^1.3.0-0">
    <variable name="APP_ID" value="xxxxxxxxxxxxxx"/>
    <variable name="APP_NAME" value="xxxxx"/>
</plugin>
<plugin name="phonegap-plugin-push" spec="^1.3.0"/>
<plugin name="cordova-plugin-device" spec="^1.0.1"/>

what i have tried -

  • copy {android_sdk_path}/extras/android/support/v13/android-support-v13.jar to libs/
    • got multiple dex files error after this
  • removed cordova.system.library.5=com.android.support:support-v13:23+ from project.properties
    • now build is successful

haven't tested push functionality yet. will report if everything is working fine.

Its still a quest (atleast for me)

build errors i am getting -

<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:18: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:220: error: package NotificationCompat does not exist
    private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName) {
                                                                ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:244: error: package NotificationCompat does not exist
    private void setNotificationCount(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                       ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:254: error: package NotificationCompat does not exist
    private void setNotificationVibration(Bundle extras, Boolean vibrateOption, NotificationCompat.Builder mBuilder) {
                                                                                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:272: error: package NotificationCompat does not exist
    private void setNotificationMessage(int notId, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                    ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:369: error: package NotificationCompat does not exist
    private void setNotificationSound(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                        ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:384: error: package NotificationCompat does not exist
    private void setNotificationLedColor(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:403: error: package NotificationCompat does not exist
    private void setNotificationPriority(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:419: error: package NotificationCompat does not exist
    private void setNotificationLargeIcon(Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder) {
                                                                                                                    ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:448: error: package NotificationCompat does not exist
    private void setNotificationSmallIcon(Context context, Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder, String localIcon) {
                                                                                                                                     ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:466: error: package NotificationCompat does not exist
    private void setNotificationIconColor(String color, NotificationCompat.Builder mBuilder, String localIconColor) {
                                                                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:124: error: package NotificationCompat does not exist
        NotificationCompat.Builder mBuilder =
                          ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:125: error: package NotificationCompat does not exist
                new NotificationCompat.Builder(context)
                                      ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:290: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:290: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                                                                        ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:300: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:300: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                                ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:310: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                              ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:310: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                                                                                  ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:322: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                              ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:322: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                            ^
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:408: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
<cordova_root>/platforms/android/src/com/adobe/phonegap/push/GCMIntentService.java:408: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                                                               ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
<cordova_root>/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java:133: error: cannot access Fragment
        shareDialog = new ShareDialog(cordova.getActivity());
                      ^
  class file for android.support.v4.app.Fragment not found
Note: <cordova_root>/platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
24 errors
:compileDebugJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJava'.
> 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: 7.62 secs

<cordova_root>/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: <cordova_root>/platforms/android/gradlew with args: cdvBuildDebug,-b,<cordova_root>/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: <cordova_root>/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: <cordova_root>/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I do have required files -

screenshot_2015-10-16_12-45-06

and here's my plugins -

<plugin name="cordova.plugin.googleplus" spec="https://github.com/EddyVerbruggen/cordova-plugin-googleplus"/>
<plugin name="cordova-plugin-whitelist" spec="^1.0.0"/>
<plugin name="cordova-plugin-customurlscheme" spec="^4.0.0">
    <variable name="URL_SCHEME" value="xxxxxx"/>
</plugin>
<plugin name="cordova-plugin-google-analytics" spec="^0.8.0"/>
<plugin name="cordova-plugin-dialogs" spec="^1.1.1"/>
<plugin name="cordova-plugin-statusbar" spec="^1.0.1"/>
<plugin name="cordova-plugin-facebook4" spec="^1.3.0-0">
    <variable name="APP_ID" value="xxxxxxxxxxxxxx"/>
    <variable name="APP_NAME" value="xxxxx"/>
</plugin>
<plugin name="phonegap-plugin-push" spec="^1.3.0"/>
<plugin name="cordova-plugin-device" spec="^1.0.1"/>

what i have tried -

  • copy {android_sdk_path}/extras/android/support/v13/android-support-v13.jar to libs/
    • got multiple dex files error after this
  • removed cordova.system.library.5=com.android.support:support-v13:23+ from project.properties
    • now build is successful

haven't tested push functionality yet. will report if everything is working fine.

@SunilSanka

This comment has been minimized.

Show comment
Hide comment
@SunilSanka

SunilSanka Jul 25, 2016

Guys I need help, I am new to Mobile App Development, I have created a sample cordova project and added the Notification Builder in MainActivity.
Find my MainActivity.java class
package com.example.phone;

import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import org.apache.cordova.*;

public class MainActivity extends CordovaActivity
{
@override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Set by in config.xml

    NotificationCompat.Builder mBuilder  = new NotificationCompat.Builder(this);
    mBuilder.setSmallIcon(R.drawable.icon);
    mBuilder.setContentText("Notification Alert, Click me!");
    mBuilder.setContentText("Hi, This is Android Notification Detail !");
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(123, mBuilder.build());

    loadUrl(launchUrl);
}

}

When I try to build the application in a command prompt using "cordova build android", I am getting the following error.
notificationcompaterror

Please help me to get get rid of this. I have added Android sdk path and Java sdk path to environment variables,

SunilSanka commented Jul 25, 2016

Guys I need help, I am new to Mobile App Development, I have created a sample cordova project and added the Notification Builder in MainActivity.
Find my MainActivity.java class
package com.example.phone;

import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import org.apache.cordova.*;

public class MainActivity extends CordovaActivity
{
@override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Set by in config.xml

    NotificationCompat.Builder mBuilder  = new NotificationCompat.Builder(this);
    mBuilder.setSmallIcon(R.drawable.icon);
    mBuilder.setContentText("Notification Alert, Click me!");
    mBuilder.setContentText("Hi, This is Android Notification Detail !");
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(123, mBuilder.build());

    loadUrl(launchUrl);
}

}

When I try to build the application in a command prompt using "cordova build android", I am getting the following error.
notificationcompaterror

Please help me to get get rid of this. I have added Android sdk path and Java sdk path to environment variables,

@felixmasila

This comment has been minimized.

Show comment
Hide comment
@felixmasila

felixmasila Dec 13, 2016

screenshot from 2016-12-13 17-18-23
screenshot from 2016-12-13 17-21-56

mine claims that the NotificationCompat package does not exist. what's wrong

screenshot from 2016-12-13 17-18-23
screenshot from 2016-12-13 17-21-56

mine claims that the NotificationCompat package does not exist. what's wrong

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot Jun 4, 2018

This thread has been automatically locked.

lock bot commented Jun 4, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.