Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

still having problems with build. #239

Closed
mohitmayank opened this issue Oct 19, 2015 · 9 comments
Closed

still having problems with build. #239

mohitmayank opened this issue Oct 19, 2015 · 9 comments

Comments

@mohitmayank
Copy link

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.

push is working fine for me after this way of building.

@macdonst
Copy link
Member

@mohitmayank Do you have the ANDROID_HOME environment variable set?

@mohitmayank
Copy link
Author

yep

$ echo $ANDROID_HOME
/home/mohit/bin/android-studio/sdk
$ ls /home/mohit/bin/android-studio/sdk
add-ons      docs    platforms       samples  system-images  tools
build-tools  extras  platform-tools  sources  temp

@macdonst
Copy link
Member

@mohitmayank it looks like things are setup correctly but your Android environment is not finding the support jar properly. I'm a bit at a loss as to why this would be the case.

@mohitmayank
Copy link
Author

@macdonst yeah this was weird. yesterday i removed the plugin and then removed the android platform. added the plugin from my repo and again added android platform and it worked. some issue with stale files maybe?
its working for me now. if you want me to run some more test on my setup such as removing the plugin and again adding from npm. i can do that. else close the thread.

@mohitmayank
Copy link
Author

@macdonst this is getting more weirder every time i build. when i am directly running
cordova run android --device it builds and runs. but when i do cordova build android it fails.
my device is nexus 5 running marshmallow.

@fredgalvao
Copy link
Collaborator

@mohitmayank Can you try a single cordova clean android && cordova build android ? The only difference between run and build is that the generated apk is installed and launched via adb after build is done, so the only thing that could be interfering is leftover from the previous build somehow messing with your build process.

@mohitmayank
Copy link
Author

@fredgalvao thanks for your tip. though clean did not help, as i was already doing platform rm android and platform add android. but i looked at the diff of both run and build outputs and found a before_build hook i made for an earlier version for facebook plugin causing issue. i was basically adding a gradle.extra file removing support library to avoid multi-dex file issue in previous facebook plugin.
but its weird the that before_build hook was not fired with cordova run.

@mohitmayank
Copy link
Author

thanks guys for help and apologies for the mess.

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants