Moodle for mobile

Struggling to build

 
Picture of Samuel Domingues
Struggling to build
 

Hi,

I've been struggling for the last three weeks just trying to get a Moodle Mobile source to build successfully and run on an Android device/emulator but after going to a lot of problems and finally getting it to start on the emulator, it does not go after the loading screen, it does not even get to the screen where you have to enter the Moodle web site. Could you please help me with this? This is what I've done:

(Windows environment)
C:\moodlemobile>ionic -v
3.20.0
C:\moodlemobile>npm -v
6.1.0
C:\moodlemobile>node -v
v6.9.1
C:\moodlemobile>cordova -v
8.0.0
C:\moodlemobile>gulp -v
[23:16:56] CLI version 3.9.1
[23:16:56] Local version 3.9.1


---Trying v3.5.0

Following the official documentation: 

1. Get source from Git:

git clone https://github.com/moodlehq/moodlemobile2.git moodlemobiledirectory cd moodlemobiledirectory git checkout v3.5.0 

2. npm setup command is not recognized, so I do: npm install && cordova prepare && gulp

3. At this point, although the tutorial says to run "ionic serve", it does not work. It fails with a lot of typescript errors, so I changed the tsconfig.json file and added this in the compilerOptions:

"typeRoots": [
"node_modules/@types"
]

Then the ionic serve finally works.

4. At this point everything seems to be working well, I can test everything from the browser and I don't see any errors, but if I try to run on Android it never goes beyond the loading screen. I don't even get the chance to enter the Moodle website URL. I even tried to remove platform android and add it back but it did not work. Any ideas?

----Trying v3.4.2 (release)

1. Unzip source code
2.  npm setup is not recognized, so I do: npm install && cordova prepare && gulp
3. ionic serve command does not show any error, but when the browser opens the app it is just a blank screen with a lot of errors on console like:


Refused to apply style from localhost:8100/build/mm.bundle.css because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

ionic.bundle.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)

(index):1 Refused to execute script from localhost:8100/lib/ionic/release/js/ionic.bundle.js because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

angular-translate.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)

These are examples of the errors because they happen multiple times for different files.


--Summarizing everything:

All I really want is to be able to successfully build this code for Android, it does not matter if it is version 3.4.2 or 3.5.0, can you please help me? I've looked everywhere and I can't find the solution for this.

Thanks

 
Average of ratings: -
Picture of Dani Palou
Re: Struggling to build
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Samuel,

can you try again using cordova 6.5.0 instead of Cordova 8? We're in the process of updating to Cordova 8, so it's better that you stick to 6.5.0 for now.

Also, please run this command:

cordova platform list

You should have these versions:

android 6.1.2

ios 4.3.1


Cheers,

Dani

 
Average of ratings: -
Picture of Samuel Domingues
Re: Struggling to build
 

Hi Dani,


Thank you for your reply, but the reason I changed the cordova version to 8.0.0 and tried to build for Android 7.0.0 is that when I keep the old versions (Cordova 6.5.0 and Android 6.1.2) the build fails with the following error:


ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:font
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontWeight

Some people were fixing this error by upgrading the Android version, but it would be better if we could actually fix this FontFamilyFont error instead of upgrading cordova/android. Can you help me figure out why this error is happening, the scenario is the same as I described before, except that cordova is 6.5.0.

Thanks

 
Average of ratings: -
Picture of Samuel Domingues
Re: Struggling to build
 

Hi Dani,

I have the android 6.1.2 version listed but the build still fails with the error message:

ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:font 

ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontStyle 

ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontWeight


Even when using phonegap, I get this error.
 

 
Average of ratings: -
Picture of Gaurav Bothra
Re: Struggling to build
 

Hi Samuel Domingues,

i am getting this error how you solve it please tell me

 
Average of ratings: -
Picture of Dani Ureña
Re: Struggling to build
Core developers
Hello Samuel and Gaurava,

This week I had the same problem and after talking with the mobile team, I was able to investigate more and, finally, I take these steps to find the solution:

I run my Android SDK Manager and see what exactly is my version of "Android SDK Build-Tools" and I specify this at the end of the file platforms/android/build.gradle :

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
}

After finding the solution I informed the mobile team And Dani has added it to the wiki:

https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2#ERROR:_In_.3Cdeclare-styleable.3E_FontFamilyFont.2C_unable_to_find_attribute_android:font

Regards.

 
Average of ratings: -
Picture of Samuel Domingues
Re: Struggling to build
 

I finally got the build working for Android, I downgraded ionic to version 2.3.3 and now it is working, but I have to specify version 6.3.0 when adding Android platform and if I try to run it on an emulator running Android 4.4 or 5.0.0 I get a blank screen after the splash screen. Any ideas?

 

 
Average of ratings: -
Picture of Dani Palou
Re: Struggling to build
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Samuel,

sorry for the delay in answering, I was also struggling to build, but in my case it was to build in production mode.

For the record, I'm able to build the app fine using Ionic 3.1.9 and the Cordova versions I specified above (I'm using a Mac). I didn't find the FontFamilyFont errors, although I find another error related to the Android support platform that I fixed by adding some lines to build.gradle, like it's explained in here:

https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2#Building_for_Android_and_iOS

Maybe those will fix your errors, but I don't know.

Cheers,

Dani

 
Average of ratings: -
Picture of Gaurav Bothra
Re: Struggling to build
 

Hello Dani Palou,

System and Node Specification

  1. Node -v : - v6.9.1
  2. npm -v :- 3.10.8
  3. gulp -v :- [12:09:17] CLI version 3.9.1
  4. I am Using Windows 10.

According to this document this Post, I successfully executed up to this step.

I am facing error in App build part

ionic cordova build android

ANDROID_HOME=C:\Users\gaura\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_171
Subproject Path: CordovaLib
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportSupportV132340Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase980Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement980Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGcm980Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesIid980Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesTasks980Library UP-TO-DATE
:prepareMeLeolinShortcutBadger1111Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\BackgroundActionButtonHandler.java:9: error: package android.support.v4.app does not exist
import android.support.v4.app.RemoteInput;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\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;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:19: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationManagerCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:20: error: package android.support.v4.app.NotificationCompat does not exist
import android.support.v4.app.NotificationCompat.WearableExtender;
                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:21: error: package android.support.v4.app does not exist
import android.support.v4.app.RemoteInput;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:442: error: package NotificationCompat does not exist
    private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName, int notId) {
                                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:525: error: package NotificationCompat does not exist
    private void setNotificationCount(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:534: error: package NotificationCompat does not exist
    private void setVisibility(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:550: error: package NotificationCompat does not exist
    private void setNotificationVibration(Bundle extras, Boolean vibrateOption, NotificationCompat.Builder mBuilder) {
                                                                                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:568: error: package NotificationCompat does not exist
    private void setNotificationMessage(int notId, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                    ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:641: error: package NotificationCompat does not exist
    private void setNotificationSound(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:658: error: package NotificationCompat does not exist
    private void setNotificationLedColor(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:677: error: package NotificationCompat does not exist
    private void setNotificationPriority(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:693: error: package NotificationCompat does not exist
    private void setNotificationLargeIcon(Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder) {
                                                                                                                    ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:722: error: package NotificationCompat does not exist
    private void setNotificationSmallIcon(Context context, Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder, String localIcon) {
                                                                                                                                     ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:740: error: package NotificationCompat does not exist
    private void setNotificationIconColor(String color, NotificationCompat.Builder mBuilder, String localIconColor) {
                                                                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\PushHandlerActivity.java:10: error: package android.support.v4.app does not exist
import android.support.v4.app.RemoteInput;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:17: error: package android.support.v4.app does not exist
import android.support.v4.app.ActivityCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:18: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:19: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Notification.java:34: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Options.java:30: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Notification.java:65: error: package NotificationCompat does not exist
    private final NotificationCompat.Builder builder;
                                    ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Notification.java:81: error: package NotificationCompat does not exist
                    NotificationCompat.Builder builder, Class<?> receiver) {
                                      ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:30: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:161: error: package NotificationCompat does not exist
    private void applyDeleteReceiver(NotificationCompat.Builder builder) {
                                                       ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:183: error: package NotificationCompat does not exist
    private void applyContentReceiver(NotificationCompat.Builder builder) {
                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\io\github\pwlin\cordova\plugins\fileopener2\FileProvider.java:28: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {
                                                            ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CameraLauncher.java:64: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CordovaUri.java:25: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\BackgroundActionButtonHandler.java:31: error: cannot find symbol
            Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
                                 ^
  symbol:   variable RemoteInput
  location: class BackgroundActionButtonHandler
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:334: error: package NotificationCompat does not exist
        NotificationCompat.Builder mBuilder =
                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:335: error: package NotificationCompat does not exist
                new NotificationCompat.Builder(context)
                                      ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:448: error: package NotificationCompat does not exist
                ArrayList<NotificationCompat.Action> wActions = new ArrayList<NotificationCompat.Action>();
                                            ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:448: error: package NotificationCompat does not exist
                ArrayList<NotificationCompat.Action> wActions = new ArrayList<NotificationCompat.Action>();
                                                                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:490: error: package NotificationCompat.Action does not exist
                    NotificationCompat.Action.Builder actionBuilder =
                                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:491: error: package NotificationCompat.Action does not exist
                        new NotificationCompat.Action.Builder(resources.getIdentifier(action.optString(ICON, ""), DRAWABLE, packageName),
                                                     ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:494: error: cannot find symbol
                    RemoteInput remoteInput = null;
                    ^
  symbol:   class RemoteInput
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:499: error: package RemoteInput does not exist
                                new RemoteInput.Builder(INLINE_REPLY)
                                               ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:505: error: package NotificationCompat does not exist
                    NotificationCompat.Action wAction = actionBuilder.build();
                                      ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:517: error: cannot find symbol
                mBuilder.extend(new WearableExtender().addActions(wActions));
                                    ^
  symbol:   class WearableExtender
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:539: error: cannot find symbol
                if (visibility >= NotificationCompat.VISIBILITY_SECRET && visibility <= NotificationCompat.VISIBILITY_PUBLIC) {
                                  ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:539: error: cannot find symbol
                if (visibility >= NotificationCompat.VISIBILITY_SECRET && visibility <= NotificationCompat.VISIBILITY_PUBLIC) {
                                                                                        ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:586: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:586: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:596: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:596: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:606: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                              ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:606: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                                                                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:618: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                              ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:618: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                            ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:682: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:682: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                                                               ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\PushHandlerActivity.java:81: error: cannot find symbol
            remoteInput = RemoteInput.getResultsFromIntent(intent);
                          ^
  symbol:   variable RemoteInput
  location: class PushHandlerActivity
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:255: error: cannot find symbol
        int permissionCheck = ContextCompat.checkSelfPermission(this.cordova.getActivity(),
                              ^
  symbol:   variable ContextCompat
  location: class IntentShim
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:261: error: cannot find symbol
            ActivityCompat.requestPermissions(this.cordova.getActivity(),
            ^
  symbol:   variable ActivityCompat
  location: class IntentShim
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:281: error: cannot find symbol
                Uri uri = FileProvider.getUriForFile(this.cordova.getActivity().getApplicationContext(), PACKAGE_NAME, uriAsFile);
                          ^
  symbol:   variable FileProvider
  location: class IntentShim
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Options.java:302: error: cannot find symbol
            return NotificationCompat.COLOR_DEFAULT;
                   ^
  symbol:   variable NotificationCompat
  location: class Options
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:121: error: package NotificationCompat does not exist
        NotificationCompat.Builder builder;
                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:123: error: package NotificationCompat does not exist
        builder = new NotificationCompat.Builder(context)
                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\io\github\pwlin\cordova\plugins\fileopener2\FileOpener2.java:110: error: cannot
find symbol
                                        path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file);
                                                           ^
  symbol:   method getUriForFile(Context,String,File)
  location: class FileProvider
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CameraLauncher.java:295: error: cannot find symbol
        this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
                                       ^
  symbol:   variable FileProvider
  location: class CameraLauncher
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CameraLauncher.java:800: error: cannot find symbol
                        Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
                                      ^
  symbol:   variable FileProvider
  location: class CameraLauncher
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.
63 errors
:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.


BUILD FAILED

* What went wrong:
Execution failed for task ':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.
Total time: 7.751 secs
Error: cmd: Command failed with exit code 1 Error output:
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\BackgroundActionButtonHandler.java:9: error: package android.support.v4.app does not exist
import android.support.v4.app.RemoteInput;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\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;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:19: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationManagerCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:20: error: package android.support.v4.app.NotificationCompat does not exist
import android.support.v4.app.NotificationCompat.WearableExtender;
                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:21: error: package android.support.v4.app does not exist
import android.support.v4.app.RemoteInput;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:442: error: package NotificationCompat does not exist
    private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName, int notId) {
                                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:525: error: package NotificationCompat does not exist
    private void setNotificationCount(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:534: error: package NotificationCompat does not exist
    private void setVisibility(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:550: error: package NotificationCompat does not exist
    private void setNotificationVibration(Bundle extras, Boolean vibrateOption, NotificationCompat.Builder mBuilder) {
                                                                                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:568: error: package NotificationCompat does not exist
    private void setNotificationMessage(int notId, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                    ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:641: error: package NotificationCompat does not exist
    private void setNotificationSound(Context context, Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:658: error: package NotificationCompat does not exist
    private void setNotificationLedColor(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:677: error: package NotificationCompat does not exist
    private void setNotificationPriority(Bundle extras, NotificationCompat.Builder mBuilder) {
                                                                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:693: error: package NotificationCompat does not exist
    private void setNotificationLargeIcon(Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder) {
                                                                                                                    ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:722: error: package NotificationCompat does not exist
    private void setNotificationSmallIcon(Context context, Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder, String localIcon) {
                                                                                                                                     ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:740: error: package NotificationCompat does not exist
    private void setNotificationIconColor(String color, NotificationCompat.Builder mBuilder, String localIconColor) {
                                                                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\PushHandlerActivity.java:10: error: package android.support.v4.app does not exist
import android.support.v4.app.RemoteInput;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:17: error: package android.support.v4.app does not exist
import android.support.v4.app.ActivityCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:18: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:19: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Notification.java:34: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Options.java:30: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Notification.java:65: error: package NotificationCompat does not exist
    private final NotificationCompat.Builder builder;
                                    ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Notification.java:81: error: package NotificationCompat does not exist
                    NotificationCompat.Builder builder, Class<?> receiver) {
                                      ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:30: error: package android.support.v4.app does not exist
import android.support.v4.app.NotificationCompat;
                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:161: error: package NotificationCompat does not exist
    private void applyDeleteReceiver(NotificationCompat.Builder builder) {
                                                       ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:183: error: package NotificationCompat does not exist
    private void applyContentReceiver(NotificationCompat.Builder builder) {
                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\io\github\pwlin\cordova\plugins\fileopener2\FileProvider.java:28: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {
                                                            ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CameraLauncher.java:64: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CordovaUri.java:25: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\BackgroundActionButtonHandler.java:31: error: cannot find symbol
            Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
                                 ^
  symbol:   variable RemoteInput
  location: class BackgroundActionButtonHandler
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:334: error: package NotificationCompat does not exist
        NotificationCompat.Builder mBuilder =
                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:335: error: package NotificationCompat does not exist
                new NotificationCompat.Builder(context)
                                      ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:448: error: package NotificationCompat does not exist
                ArrayList<NotificationCompat.Action> wActions = new ArrayList<NotificationCompat.Action>();
                                            ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:448: error: package NotificationCompat does not exist
                ArrayList<NotificationCompat.Action> wActions = new ArrayList<NotificationCompat.Action>();
                                                                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:490: error: package NotificationCompat.Action does not exist
                    NotificationCompat.Action.Builder actionBuilder =
                                             ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:491: error: package NotificationCompat.Action does not exist
                        new NotificationCompat.Action.Builder(resources.getIdentifier(action.optString(ICON, ""), DRAWABLE, packageName),
                                                     ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:494: error: cannot find symbol
                    RemoteInput remoteInput = null;
                    ^
  symbol:   class RemoteInput
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:499: error: package RemoteInput does not exist
                                new RemoteInput.Builder(INLINE_REPLY)
                                               ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:505: error: package NotificationCompat does not exist
                    NotificationCompat.Action wAction = actionBuilder.build();
                                      ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:517: error: cannot find symbol
                mBuilder.extend(new WearableExtender().addActions(wActions));
                                    ^
  symbol:   class WearableExtender
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:539: error: cannot find symbol
                if (visibility >= NotificationCompat.VISIBILITY_SECRET && visibility <= NotificationCompat.VISIBILITY_PUBLIC) {
                                  ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:539: error: cannot find symbol
                if (visibility >= NotificationCompat.VISIBILITY_SECRET && visibility <= NotificationCompat.VISIBILITY_PUBLIC) {
                                                                                        ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:586: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:586: error: package NotificationCompat does not exist
                NotificationCompat.InboxStyle notificationInbox = new NotificationCompat.InboxStyle()
                                                                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:596: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:596: error: package NotificationCompat does not exist
                NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                                ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:606: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                              ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:606: error: package NotificationCompat does not exist
            NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
                                                                                  ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:618: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                              ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:618: error: package NotificationCompat does not exist
            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
                                                                            ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:682: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:682: error: cannot find symbol
                if (priority >= NotificationCompat.PRIORITY_MIN && priority <= NotificationCompat.PRIORITY_MAX) {
                                                                               ^
  symbol:   variable NotificationCompat
  location: class GCMIntentService
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\adobe\phonegap\push\PushHandlerActivity.java:81: error: cannot find symbol
            remoteInput = RemoteInput.getResultsFromIntent(intent);
                          ^
  symbol:   variable RemoteInput
  location: class PushHandlerActivity
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:255: error: cannot find symbol
        int permissionCheck = ContextCompat.checkSelfPermission(this.cordova.getActivity(),
                              ^
  symbol:   variable ContextCompat
  location: class IntentShim
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:261: error: cannot find symbol
            ActivityCompat.requestPermissions(this.cordova.getActivity(),
            ^
  symbol:   variable ActivityCompat
  location: class IntentShim
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\com\darryncampbell\plugin\intent\IntentShim.java:281: error: cannot find symbol
                Uri uri = FileProvider.getUriForFile(this.cordova.getActivity().getApplicationContext(), PACKAGE_NAME, uriAsFile);
                          ^
  symbol:   variable FileProvider
  location: class IntentShim
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Options.java:302: error: cannot find symbol
            return NotificationCompat.COLOR_DEFAULT;
                   ^
  symbol:   variable NotificationCompat
  location: class Options
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:121: error: package NotificationCompat does not exist
        NotificationCompat.Builder builder;
                          ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\de\appplant\cordova\plugin\notification\Builder.java:123: error: package NotificationCompat does not exist
        builder = new NotificationCompat.Builder(context)
                                        ^
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\io\github\pwlin\cordova\plugins\fileopener2\FileOpener2.java:110: error: cannot
find symbol
                                        path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file);
                                                           ^
  symbol:   method getUriForFile(Context,String,File)
  location: class FileProvider
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CameraLauncher.java:295: error: cannot find symbol
        this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
                                       ^
  symbol:   variable FileProvider
  location: class CameraLauncher
C:\Users\gaura\Desktop\moodlemobile2\platforms\android\src\org\apache\cordova\camera\CameraLauncher.java:800: error: cannot find symbol
                        Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
                                      ^
  symbol:   variable FileProvider
  location: class CameraLauncher
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.
63 errors

FAILURE: Build failed with an exception.

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


 
Average of ratings: -
Picture of Dani Palou
Re: Struggling to build
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Gaurav,

please try to add these lines at the end of platforms/android/build.gradle:

configurations.all {

     resolutionStrategy.force 'com.android.support:support-v4:24.0.0'

 }

Also, please open the Android SDK Manager and make sure you have the support library installed.

Cheers,

Dani

 
Average of ratings: -
Picture of Gaurav Bothra
Re: Struggling to build
 

Thanks for reply Dani,

Support Library is installed in Android Studio and I already added this line at the end of build.gradle file

configurations.all {

     resolutionStrategy.force 'com.android.support:support-v4:24.0.0'

 }


I getting same same error as mentioned above



 
Average of ratings: -
Picture of behnaz ranjbar
Re: Struggling to build
 

hello,

Same error and i've examined every way that i've read in the net sad but no results.

have you found out why?

 
Average of ratings: -
Picture of behnaz ranjbar
Re: Struggling to build
 

i could solve my own problem,the solution may be useful for you too:

at the first i ran 'cordova requirements android' command in terminal

there should be installed versions front of Android target

if not (same as mesmile) follow the instructions to update cordova, after updating go to your android studio

just remember before generating apk from android studio first run it in android studio (i don't know why but it works for memixed)


 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

Hi Dani,

I managed to build the app without any error. The apk installs on Android mobile with the proper icon. But it only shows a white screen. No splash.

Do the Gradle, Gradle wrapper, and NodeJS versions matter like Cordova, and ionic?

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

When I executed "install -g cordova@6.5.0 ionic" I received the following warnings:


C:\Files>npm install -g cordova@6.5.0 ionic
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\cc\AppData\Roaming\npm\cordova -> C:\Users\cc\AppData\Roaming\npm\node_
modules\cordova\bin\cordova
C:\Users\cc\AppData\Roaming\npm\ionic -> C:\Users\cc\AppData\Roaming\npm\node_mo
dules\ionic\bin\ionic
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\ion
ic\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)

+ cordova@6.5.0
+ ionic@3.20.0
updated 6 packages in 75.999s


Also when I executed "npm install -g gulp" I received the following warnings:


C:\Files>npm install -g gulp
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, follo
wing the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for comp
atibility with current and future versions of Node.js
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher
 to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher
 to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compa
tibility with current and future versions of Node.js
C:\Users\cc\AppData\Roaming\npm\gulp -> C:\Users\cc\AppData\Roaming\npm\node_mod
ules\gulp\bin\gulp.js
+ gulp@3.9.1
updated 1 package in 32.486s

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

When I execute "npm run setup" it also shows the following errors: I execute it from c:\files\moodle1 in which I cloned the Github package.


C:\Files\moodle1>npm run setup

> magfaapp@3.5.0 setup C:\Files\moodle1
> npm install && cordova prepare && gulp

npm WARN deprecated node-uuid@1.4.7: Use uuid module instead
npm WARN tarball tarball data for lodash@1.0.2 (sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE
=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for esprima@4.0.0 (sha512-oftTcaMu/EGrEIu904mWteKI
v8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==) seems to be co
rrupted. Trying one more time.
npm WARN tarball tarball data for esutils@2.0.2 (sha1-Cr9PHKpbyx96nYrMbepPqqBLrJ
s=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for fast-json-stable-stringify@2.0.0 (sha1-1RQsDK7
msRifh9OnYREGT4bIu/I=) seems to be corrupted. Trying one more time.
npm ERR! path C:\Files\moodle1\node_modules\.staging\esprima-37c63c7f\ChangeLog
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Files\moodle1\node_mo
dules\.staging\esprima-37c63c7f\ChangeLog'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'C:\Files\moodle1\nod
e_modules\.staging\esprima-37c63c7f\ChangeLog']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'C:\Files\moodle1\no
de_modules\.staging\esprima-37c63c7f\ChangeLog'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'C:\\Files\\moodle1\\node_modules\\.staging\\esprima-37c63c7f\\Ch
angeLog' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'C:\\Files\\moodle1\
\node_modules\\.staging\\esprima-37c63c7f\\ChangeLog\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'C:\\Files\\moodle1\\node_modules\\.staging\\esprima-37c63c7f\\Chang
eLog',
npm ERR!   parent: 'magfaapp' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or ant
ivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check t
he
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended
).
npm WARN tarball tarball data for fresh@0.5.2 (sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=
) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for fs.realpath@1.0.0 (sha1-FQStJSMVjKpA20onh8sBQR
mU6k8=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for graceful-fs@1.2.3 (sha1-FaSAaldUfLLS2/J/QuiajD
RRs2Q=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for filename-regex@2.0.1 (sha1-wcS5vuPglyXdsQa3XB4
wH+LxiyY=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for events@1.1.1 (sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ
=) seems to be corrupted. Trying one more time.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\cc\AppData\Roaming\npm-cache\_logs\2018-06-26T06_53_08_984
Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963248
npm ERR! magfaapp@3.5.0 setup: `npm install && cordova prepare && gulp`
npm ERR! Exit status 4294963248
npm ERR!
npm ERR! Failed at the magfaapp@3.5.0 setup script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\cc\AppData\Roaming\npm-cache\_logs\2018-06-26T06_59_09_912
Z-debug.log

C:\Files\moodle1>n


 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

I finally solved the problem, and built a working Android app.

As I found the main problem is with Node.JS. I had installed the latest version (10.5). According to the documentation, I switched to 6.9.1.

Here are the steps:

1) Install Node.JS version 6.9.1

2) Install JAVA SDK, and add JAVA_HOME environment variable (if not exists)

3) npm cache clean

4) npm install -g cordova@6.5.0 ionic

5) npm install -g gulp

6) npm install --global --production windows-build-tools

7) git clone https://github.com/moodlehq/moodlemobile2.git moodlemobiledirectory

8) cd moodlemobiledirectory

9) Add "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin" to system PATH (Omitted from documentations).    Add "c:\users\....\AppData\Roaming\npm\node_modules\gulp\bin" to PATH. Must be added before step 10.

10) npm run setup

11) Open the file platforms/android/build.gradle and add this code at the end:

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
}
12) Install Android Studio & add its installation folder to the system PATH.

13) Run Android studio & install Android SDK. Add tools, tools\bin, and platform-tools folders to the system PATH. Set ANDROID_HOME environment variable to the SDK installation folder.

14) In Android studio, import project, and select the platform\android folder inside the package

15) During Sync, it shows a message like "versions of Android Gradle plugin & Gradle are not compatible". Do not select update plugin. Select Downgrade Gradle to 3.5. (in my case, with Android studio 3.1.3 & Gradle 4.4). Some APIs are changed in the newer version, and you will receive more errors.

As you see I did not execute "git checkout v3.5.0". It deletes some folders from package like www, e2e, hooks,scss.

Hope this resolves the problem for all.


 
Average of ratings: Useful (3)
Picture of Samuel Domingues
Re: Struggling to build
 

Have you tested on older Android versions like 5.0.0 or 4.4.4?

Thanks

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

I installed the app on a tablet with Android 4.4. It works. Although like the original app, the site input page is shifted to the right.

It is natural because in Android studio I built the app with Android 8 (API level 26). You can build it with the proper API level.

 
Average of ratings: -
Picture of behnaz ranjbar
Re: Struggling to build
 

thank you so much payman, but in this case i think that it won't build the last version app, yes?

again it would be a problem if we want to have the 3.5 itself


 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

You're welcome.

I am searching to find what to do to upgrade to 3.5.0 version. Of-course there should be a solution.

Also I will test if Cordova 8 works.

 
Average of ratings: -
Picture of behnaz ranjbar
Re: Struggling to build
 

Now i faced the famous white screen problem...any solution payman?

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

I had this problem before downgrading to Node.JS 6.9.1, adding Microsoft visual Studio to the system PATH, and removing the ''git checkout v3.5.0".  Pay attention to any error (not warning due to some dependency versions) during "npm run setup". 

Regarding the "git checkout v3.5.0". It removes the Cordova project from the package folder. It is the reason to delete the mentioned folders. I am trying to create a new Cordova project, and copy the required files from the 3.5.0 version.

 
Average of ratings: -
Picture of behnaz ranjbar
Re: Struggling to build
 

i did all of those steps but white screen was still there i could solve it by another way

by running ionic doctor check and it shows me some errors and i resolved them

finally i could see my own splash screenbig grin

but now i have another problem sometimes (not all the times) that i run the app ,after my own splash screen, moodle's splash screen appears too! do you know why?

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

The second splash comes from the site. In Site Administration->Mobile App->Mobile appearance menu, in mobilecssurl you should set a valid URL to a customized CSS file.

The CSS should be placed inside your Moodle installation (in your custom theme or inside a local plugin).

For example: https://mymoodlesite.com/theme/mytheme/style/mymobileapp.css


 
Average of ratings: -
Picture of behnaz ranjbar
Re: Struggling to build
 

thank you so much for your answering but i have set a valid and fixed url to my app but not in a css, i've set in config.json

my app doesn't show the url page it's directly go to login page but moodle splash is still there

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

It makes no difference. The second splash is loaded from your site. You should make a CSS file, and upload it in a folder inside your theme folder, and set its URL in mobilecssurl.

In the forum I found that some people who managed to do this with older version app, have problem with the latest version. It seems that they have changed the CSS template.

Here is the moodle document:

https://docs.moodle.org/35/en/Moodle_Mobile_guide_for_admins#Customise_your_app_theme


Customise your app theme

The app can also retrieve your custom styles from your Moodle site. Since the app is a HTML5 app, you can safely apply any CSS, CSS2 and CSS3 style.

Go to Administration > Site administration > Mobile app > Mobile appearance and enter in the mobilecssurl field a valid URL pointing to a CSS file containing your custom styles.

The CSS should be placed inside your Moodle installation (in your custom theme or inside a local plugin).

For example: https://mymoodlesite.com/theme/mytheme/style/mymobileapp.css

Once the user is logged in the app, remote CSS files for applying your custom styles are regularly retrieved.

Notice that on the first time a user opens the app, he will see the default "orange" style. Your custom styles will be applied once the user has added a site in the app.


 
Average of ratings: Useful (1)
Picture of behnaz ranjbar
Re: Struggling to build
 

i will try it thanks

 
Average of ratings: -
Picture of Gaurav Bothra
Re: Struggling to build
 

Hello Payman Zafar,

I changed default css to my own custom css. Css is applied successfully but Second Splash Screen from site is there after my own splash screen

Any solution??

 
Average of ratings: -
Picture of behnaz ranjbar
Re: Struggling to build
 

and again me too

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

Hi,

The second splash screen is actually an HTML page loaded when there is a long time connecting to the site. You can find it in src\core\login\pages\init folder.

You can edit this HTML file, or replace the splash_logo.png file in src\assets\img folder with your own logo.

Run ionic cordova prepare, and then build the app.

 
Average of ratings: -
Picture of Payman Zafar
Re: Struggling to build
 

Hi,

I am sorry for the delay.

I think the following document will help:

https://docs.moodle.org/dev/Moodle_Mobile_Themes

 
Average of ratings: -