transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.56k stars 427 forks source link

Unable to get provider error #405

Closed antonsivogrivov closed 6 years ago

antonsivogrivov commented 6 years ago

Your Environment

Expected Behavior

My app starting successfully

Actual Behavior

My app has stopped on startup

Steps to Reproduce

Just want to see my app working on the device. It works in genymotion.

Debug logs

java.lang.RuntimeException: Unable to get provider com.transistorsoft.locationmanager.util.LogFileProvider: java.lang.ClassNotFoundException: Didn't find class "com.transistorsoft.locationmanager.util.LogFileProvider"

christocracy commented 6 years ago

You Android OS 4.2.1 is too low.

Minimum I test for is 4.3.3

antonsivogrivov commented 6 years ago

Thanks, I understand

christocracy commented 6 years ago

I will certainly like to handle this error more gracefully.

antonsivogrivov commented 6 years ago

Maybe you can do support Android versions like in react-native? Minimum is 4.1

christocracy commented 6 years ago

I cannot support 4.1. I use specific APIs that RN does not.

christocracy commented 6 years ago

This is not primarily an RN module. This is a pure-native library that happens to have bindings for RN.

It has bindings for other platforms as well, such as Cordova and NativeScript.

The needs of the native library determine the min version, not RN.

benjaminkoetting commented 6 years ago

In this case API version 18 is the minimum for your plugin?

christocracy commented 6 years ago

The library itself is built for minSdkVersion 16. This may be lower than what React Native supports.

benjaminkoetting commented 6 years ago

yesterday I got the same error on a Samsung S3 with Androi 4.4.2 and with Android 4.3, which device do you use for version 4.3.3 testing?

christocracy commented 6 years ago

What is evryone’s compileSdk?

benjaminkoetting commented 6 years ago

compileSdkVersion 26 buildToolsVersion '26.0.2'

antonsivogrivov commented 6 years ago

compileSdkVersion 27 buildToolsVersion 27.0.3

benjaminkoetting commented 6 years ago

@christocracy can you reproduce it? is this something you have to fix, or is there a way we can handle or catch it?

christocracy commented 6 years ago

It’s not really something that needs to be caught. It’s a symptom of something not setup correctly.

Show me your $ adb logcat of app bottling from scratch.

benjaminkoetting commented 6 years ago

ok, hopefully that is what you need:

exception.txt

christocracy commented 6 years ago

As you can see, you have a whole raft of issues leading up to FileProvider error:

What version app-compat-v7 are you including?

I/dalvikvm( 3484): Could not find method android.content.Context.createDeviceProtectedStorageContext, referenced from method android.support.v4.content.ContextCompat.createDeviceProtectedStorageContext
W/dalvikvm( 3484): VFY: unable to resolve virtual method 669: Landroid/content/Context;.createDeviceProtectedStorageContext ()Landroid/content/Context;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
D/EGL_emulation( 1756): eglMakeCurrent: 0xb7d451b0: ver 2 0
I/dalvikvm( 3484): Could not find method android.content.Context.getCodeCacheDir, referenced from method android.support.v4.content.ContextCompat.getCodeCacheDir
W/dalvikvm( 3484): VFY: unable to resolve virtual method 677: Landroid/content/Context;.getCodeCacheDir ()Ljava/io/File;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm( 3484): Could not find method android.content.Context.getColor, referenced from method android.support.v4.content.ContextCompat.getColor
W/dalvikvm( 3484): VFY: unable to resolve virtual method 678: Landroid/content/Context;.getColor (I)I
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm( 3484): Could not find method android.content.Context.getColorStateList, referenced from method android.support.v4.content.ContextCompat.getColorStateList
W/dalvikvm( 3484): VFY: unable to resolve virtual method 679: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm( 3484): Could not find method android.content.Context.getDataDir, referenced from method android.support.v4.content.ContextCompat.getDataDir
W/dalvikvm( 3484): VFY: unable to resolve virtual method 681: Landroid/content/Context;.getDataDir ()Ljava/io/File;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm( 3484): Could not find method android.content.Context.getDrawable, referenced from method android.support.v4.content.ContextCompat.getDrawable
W/dalvikvm( 3484): VFY: unable to resolve virtual method 683: Landroid/content/Context;.getDrawable (I)Landroid/graphics/drawable/Drawable;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm( 3484): Could not find method android.content.Context.getNoBackupFilesDir, referenced from method android.support.v4.content.ContextCompat.getNoBackupFilesDir
W/dalvikvm( 3484): VFY: unable to resolve virtual method 690: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm( 3484): Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method android.support.v4.content.ContextCompat.isDeviceProtectedStorage
W/dalvikvm( 3484): VFY: unable to resolve virtual method 703: Landroid/content/Context;.isDeviceProtectedStorage ()Z
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm( 3484): Could not find method android.content.Context.startForegroundService, referenced from method android.support.v4.content.ContextCompat.startForegroundService
W/dalvikvm( 3484): VFY: unable to resolve virtual method 720: Landroid/content/Context;.startForegroundService (Landroid/content/Intent;)Landroid/content/ComponentName;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
D/EGL_emulation( 1756): eglMakeCurrent: 0xb7d451b0: ver 2 0
W/DynamiteModule( 3484): Local module descriptor class for com.google.firebase.auth not found.
W/DynamiteModule( 3484): Local module descriptor class for com.google.firebase.auth not found.
I/dalvikvm( 3484): Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.zzo.zzv
W/dalvikvm( 3484): VFY: unable to resolve virtual method 843: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0013
I/BiChannelGoogleApi( 3484): [FirebaseAuth: ] No Fallback module; NOT setting up for lazy initialization
I/dalvikvm( 3484): Could not find method android.content.Context.getNoBackupFilesDir, referenced from method com.google.android.gms.common.util.zzv.getNoBackupFilesDir
W/dalvikvm( 3484): VFY: unable to resolve virtual method 690: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File;
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x0006
W/DynamiteModule( 3484): Local module descriptor class for com.google.firebase.auth not found.
I/dalvikvm( 3484): Could not find method android.content.pm.PackageManager.isInstantApp, referenced from method com.google.android.gms.internal.zzbgb.zzamj
W/dalvikvm( 3484): VFY: unable to resolve virtual method 850: Landroid/content/pm/PackageManager;.isInstantApp (Ljava/lang/String;)Z
D/dalvikvm( 3484): VFY: replacing opcode 0x6e at 0x002d
E/dalvikvm( 3484): Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcki.zzbam
W/dalvikvm( 3484): VFY: unable to resolve check-cast 76 (Landroid/app/job/JobScheduler;) in Lcom/google/android/gms/internal/zzcki;
D/dalvikvm( 3484): VFY: replacing opcode 0x1f at 0x000b
E/dalvikvm( 3484): Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcki.zzr
W/dalvikvm( 3484): VFY: unable to resolve check-cast 76 (Landroid/app/job/JobScheduler;) in Lcom/google/android/gms/internal/zzcki;
D/dalvikvm( 3484): VFY: replacing opcode 0x1f at 0x009d
W/ProviderHelper( 1702): Unknown dynamite feature flags
I/DynamiteModule( 3484): Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:0
I/DynamiteModule( 3484): Selected local version of com.google.android.gms.flags
D/dalvikvm( 3484): DexOpt: unable to opt direct call 0x01b6 at 0xa5 in Lcom/google/android/gms/internal/zzcki;.zzr
D/dalvikvm( 3484): DexOpt: unable to opt direct call 0x082c at 0xb3 in Lcom/google/android/gms/internal/zzcki;.zzr
D/dalvikvm( 3484): GC_FOR_ALLOC freed 331K, 11% free 3297K/3700K, paused 9ms, total 12ms
I/FirebaseAuth( 3484): [FirebaseAuth:] Loading module via FirebaseOptions.
I/FirebaseInitProvider( 3484): FirebaseApp initialization successful
D/AndroidRuntime( 3484): Shutting down VM
W/dalvikvm( 3484): threadid=1: thread exiting with uncaught exception (group=0x9ccb9b20)
W/DynamiteModule( 3484): Local module descriptor class for com.google.android.gms.crash not found.
E/UncaughtException( 3484): 
E/UncaughtException( 3484): java.lang.RuntimeException: Unable to get provider com.transistorsoft.locationmanager.util.LogFileProvider: java.lang.ClassNotFoundException:
benjaminkoetting commented 6 years ago

you mean this? sorry I'm not an android developer.

compile "com.android.support:appcompat-v7:26.1.0"

christocracy commented 6 years ago

Show me your entire app/build.gradle

benjaminkoetting commented 6 years ago

please find attached and thanks for your support!

build-gradle.txt

christocracy commented 6 years ago
$ cd  android
$ ./gradlew app:dependencies
christocracy commented 6 years ago

Also, are you opening your app in Android Studio? It's probably showing a bunch of helpful build warnings.

benjaminkoetting commented 6 years ago

in adroid studio I see this warnings:

Warning:string 'catalyst_debugjs' has no default translation. Warning:string 'catalyst_element_inspector' has no default translation. Warning:string 'catalyst_jsload_error' has no default translation. Warning:string 'catalyst_jsload_message' has no default translation. Warning:string 'catalyst_jsload_title' has no default translation. Warning:string 'catalyst_reloadjs' has no default translation. Warning:string 'catalyst_settings' has no default translation. Warning:string 'catalyst_settings_title' has no default translation.

benjaminkoetting commented 6 years ago

output from app:dependencies

dependencies.txt

benjaminkoetting commented 6 years ago

Just made a new Test with a Samsung S6 Version 5.0.2 with this the start is OK, Version 4.4.2 with Sasmsung S3 and S4 have the same error reported in this thread.

christocracy commented 6 years ago

I’m not surprised. You have messed up dependencies.

benjaminkoetting commented 6 years ago

ok, this will then have only effect below 5.0.2? I can check this with the dependencies command?

christocracy commented 6 years ago

Your problem is with react-native-mapbox including app-compat-v7:25.4.0

+--- project :mapbox-react-native-mapbox-gl
|    +--- com.mapbox.mapboxsdk:mapbox-android-services:2.2.9
|    |    +--- com.mapbox.mapboxsdk:mapbox-java-services:2
.    .
.    .
|    |    +--- com.android.support:appcompat-v7:25.4.0 -> 27.0.2 (*)

The version of any appcompat dependency must correspond to your compileSdkVersion.

You're using compileSdkVersion 26 so your app (and all its dependencies) must require appcompa at 26+

benjaminkoetting commented 6 years ago

ah ok, thanks for your support. I will try to resolve the depencies problem and will test it again.

christocracy commented 6 years ago

You can analyze your own dependencies. Wherever you see an (*) is a conflict

christocracy commented 6 years ago

In the next commit I post, I’m going to allow configuration of the plugin’s compileSdkVersion, buildToolsVersion, playServicesVersion, appCompatVersion via gradle variables defined in your own app/build.gradle. I see some plugins beginning to do this now.

It will be explained more in the next PR I merge.

benjaminkoetting commented 6 years ago

sounds good, i have now delete the react-native-mapbox from the android project but get the same error, so must be a second library with dependencie problem.

benjaminkoetting commented 6 years ago

I had today a debug session with an android developer and he added this 5 lines of code to my MainApplication.java and now I can run my app on lower API Versions than 21

@Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
  }