dpa99c / cordova-diagnostic-plugin

Cordova/Phonegap plugin to manage device settings
539 stars 361 forks source link

Build failed on Android #480

Open tomasantunes opened 2 years ago

tomasantunes commented 2 years ago

When I add the plugin the build fails for Android with the following error:

C:\Users\tomas\Documents\musicshare\platforms\android\app\src\main\java\cordova\plugins\Diagnostic.java:57: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app
C:\Users\tomas\Documents\musicshare\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_External_Storage.java:28: error: cannot find symbol
import android.support.v4.os.EnvironmentCompat;
                            ^
  symbol:   class EnvironmentCompat
  location: package android.support.v4.os
C:\Users\tomas\Documents\musicshare\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:35: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
                             ^
  symbol:   class NotificationManagerCompat
  location: package android.support.v4.app
C:\Users\tomas\Documents\musicshare\platforms\android\app\src\main\java\cordova\plugins\Diagnostic.java:639: error: cannot find symbol
            java.lang.reflect.Method method = ActivityCompat.class.getMethod("shouldShowRequestPermissionRationale", Activity.class, java.lang.String.class);
                                              ^
  symbol:   class ActivityCompat
  location: class cordova.plugins.Diagnostic
C:\Users\tomas\Documents\musicshare\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_External_Storage.java:216: error: cannot find symbol
                    addPath = Environment.MEDIA_MOUNTED.equals(EnvironmentCompat.getStorageState(file));
                                                               ^
  symbol:   variable EnvironmentCompat
  location: class cordova.plugins.Diagnostic_External_Storage
C:\Users\tomas\Documents\musicshare\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:123: error: cannot find symbol
        NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this.cordova.getActivity().getApplicationContext());
        ^
  symbol:   class NotificationManagerCompat
  location: class cordova.plugins.Diagnostic_Notifications
C:\Users\tomas\Documents\musicshare\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:123: error: cannot find symbol
        NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this.cordova.getActivity().getApplicationContext());
                                                              ^
  symbol:   variable NotificationManagerCompat
  location: class cordova.plugins.Diagnostic_Notifications
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.
7 errors
dpa99c commented 2 years ago

This could be due to a conflict with another plugin. Please try building the example project which is a known codebase, to validate your build environment.