Closed shahchaitanya closed 7 years ago
this plugin is set up to use the newest 9.4.0 version of google play services - https://github.com/globocom/react-native-ua/blob/master/android/build.gradle
If you have a mismatch of google play services versions it will most likely crash. You can see all the dependencies by running dependencies
gradle task on your app module, e.g., /gradlew app:dependencies
.
Having the same issue. Android crashes on startup on device only, no issues with simulator.
React-Native 0.38.1 All google play services: 10.2.0
The crash only occurs when the AndroidManifest.xml includes a permission request for location:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Commenting out the permission requests eliminates the issue.
StackTrace from Android Studio:
02-23 09:54:30.696 12033-12033/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:54:31.096 12016-12049/? E/AndroidRuntime: FATAL EXCEPTION: LocationService
Process: com.app, PID 12345
java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;Landroid/os/Looper;ILcom/google/android/gms/common/internal/zzg;Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;Lcom/google/android/gms/common/api/GoogleApiClient$OnConnectionFailedListener;)V in class Lcom/google/android/gms/common/internal/zzk; or its super classes (declaration of 'com.google.android.gms.common.internal.zzk' appears in /data/app/com.semios-1/base.apk)
at com.google.android.gms.location.internal.zzb.<init>(Unknown Source)
at com.google.android.gms.location.internal.zzl.<init>(Unknown Source)
at com.google.android.gms.location.LocationServices$1.zzo(Unknown Source)
at com.google.android.gms.location.LocationServices$1.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zzvq(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
at com.urbanairship.location.FusedLocationAdapter.connect(FusedLocationAdapter.java:108)
at com.urbanairship.location.UALocationProvider.cancelRequests(UALocationProvider.java:63)
at com.urbanairship.location.LocationService.onCheckLocationUpdates(LocationService.java:424)
at com.urbanairship.location.LocationService.onHandleIntent(LocationService.java:195)
at com.urbanairship.location.LocationService.access$600(LocationService.java:38)
at com.urbanairship.location.LocationService$IncomingHandler.handleMessage(LocationService.java:556)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
02-23 09:54:31.717 866-12059/? E/android.os.Debug: !@Dumpstate > sdumpstate -k -t -z -d -o /data/log/dumpstate_app_error
02-23 09:54:35.511 12139-12139/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:54:37.663 12148-12148/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
02-23 09:54:37.663 12148-12148/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
02-23 09:54:37.663 12148-12148/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
02-23 09:54:37.663 12148-12148/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
02-23 09:54:37.663 12148-12148/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
02-23 09:54:40.686 12212-12212/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:54:45.741 12235-12235/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:54:50.705 12245-12245/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:54:54.749 313-833/? E/QCameraHWI_Parm: setPreviewFpsRange: error: FPS range (15, 30) not supported
02-23 09:54:55.690 12287-12287/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:00.755 12313-12313/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:05.660 12342-12342/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:06.991 343-343/? I/Atfwd_Daemon: result : -1 ,Init step :2 ,qmiErrorCode: 0
02-23 09:55:08.583 1274-1274/? E/SoundPool: error loading /system/media/audio/ui/lens_flare_tap.ogg
02-23 09:55:08.583 1274-1274/? E/SoundPool: error loading /system/media/audio/ui/lens_flare_unlock.ogg
02-23 09:55:08.723 313-761/? V/AwesomePlayer: startAudioPlayer_l, sendErrorNotification (0)
02-23 09:55:09.033 313-313/? V/AwesomePlayer: startAudioPlayer_l, sendErrorNotification (0)
02-23 09:55:10.715 12364-12364/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:15.690 12365-12365/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:20.715 12366-12366/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:25.720 12367-12367/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:30.745 12368-12368/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:35.759 12369-12369/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:40.774 12370-12370/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:45.789 12371-12371/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:51.345 12373-12373/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:55:55.829 12374-12374/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:00.834 12399-12399/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:01.054 12375-12400/? E/AndroidRuntime: FATAL EXCEPTION: LocationService
Process: com.app, PID 12345
java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;Landroid/os/Looper;ILcom/google/android/gms/common/internal/zzg;Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;Lcom/google/android/gms/common/api/GoogleApiClient$OnConnectionFailedListener;)V in class Lcom/google/android/gms/common/internal/zzk; or its super classes (declaration of 'com.google.android.gms.common.internal.zzk' appears in /data/app/com.semios-1/base.apk)
at com.google.android.gms.location.internal.zzb.<init>(Unknown Source)
at com.google.android.gms.location.internal.zzl.<init>(Unknown Source)
at com.google.android.gms.location.LocationServices$1.zzo(Unknown Source)
at com.google.android.gms.location.LocationServices$1.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zzvq(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
at com.urbanairship.location.FusedLocationAdapter.connect(FusedLocationAdapter.java:108)
at com.urbanairship.location.UALocationProvider.cancelRequests(UALocationProvider.java:63)
at com.urbanairship.location.LocationService.onCheckLocationUpdates(LocationService.java:424)
at com.urbanairship.location.LocationService.onHandleIntent(LocationService.java:195)
at com.urbanairship.location.LocationService.access$600(LocationService.java:38)
at com.urbanairship.location.LocationService$IncomingHandler.handleMessage(LocationService.java:556)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
02-23 09:56:05.869 12416-12416/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:10.894 12417-12417/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:15.899 12420-12420/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:20.924 12422-12422/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:25.938 12423-12423/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:30.963 12424-12424/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:35.978 12425-12425/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:41.003 12426-12426/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:46.018 12438-12438/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:51.433 12440-12440/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-23 09:56:56.058 12441-12441/? E/Diag_Lib: Diag_LSM_Init: Failed to open handle to diag driver, error = 2
@ShMcK That is also caused by the mismatch Google Play services versions. Could you post your apps dependencies?
I posted the deps to a file (quite large) and searched through it. ./gradlew app:dependencies > deps.md
. All Google play services are the same: 10.2.0.
I also replicated the issue to ensure it was 'react-native-ua' in a separate new project, with the same result.
It crashed with 'react-native-ua' and any request to location permissions, FINE or COARSE.
Android device only. On multiple devices.
No issue with simulators or IOS.
@ShMcK No such method issues like you are seeing are almost always caused by a mismatch. I really need to see the output.
@ShMcK Your build.gradle might be enough to figure it out
Build Gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"]
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
// dot env
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
// select fonts to add
project.ext.vectoricons = [
iconFontNames: [ 'FontAwesome.ttf', 'Ionicons.ttf', 'weather.ttf' ]
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.semios"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-image-to-base64')
compile project(':react-native-google-analytics-bridge')
compile project(':react-native-camera')
compile project(':bugsnag-react-native')
compile project(':react-native-config')
compile project(':react-native-vector-icons')
compile project(':react-native-code-push')
compile project(':react-native-svg')
compile project(':react-native-localization')
compile project(':react-native-device-info')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
Well I was not expecting so many sub projects. The dependencies output is probably required. Before that, try adding:
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
to your dependencies and see if that fixes your issues. If you are using +
in a different build.gradle file, you might want to switch 10.2.0
to +
as well.
Assuming you are using https://github.com/idehub/react-native-google-analytics-bridge this plugin you will want to use
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-location:+'
That's true, there seemed to be a conflict with react-native-google-analytics-bridge.
Everything seems to be working now after applying your code reccomendations. Thank you!
When I open app, it is crashed. My build.gradle file seems like this : dependencies { compile project(':react-native-push-notification') compile(project(":react-native-google-signin")){ exclude group: "com.google.android.gms" // very important } compile 'com.google.android.gms:play-services-auth:9.2.1' // should be at least 9.0.0 compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // From node_modules compile 'com.android.support:multidex:1.0.1' } apply plugin: 'com.google.gms.google-services'
I guess problem is due to gms version.