zhangtaii / react-native-google-place-picker

React Native Wrapper of Google Place Picker for iOS + Android.
MIT License
185 stars 54 forks source link

I got a runtime error on Android #9

Closed spksoft closed 7 years ago

spksoft commented 7 years ago

I try to make a simple code to test this Library. It can run on iOS as well. But in Android, it doesn't work and give me an error below. the error below happens after pressing the 'Select' button of GooglePlacePicker (the library can normally show GooglePlacePicker Dialog but when I press the button to select the location, it will be Runtime Error)

I also test this on Genymotion and my phone either but it still doesn't work on both.

Genymotion

Genymotion : 2.7.2
Android : 6.0

My smart phone

Phone : Lenovo Vibe K5 Note
Android : 6.0

index.android.js


/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/

import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, TouchableOpacity, } from 'react-native'; import RNGooglePlacePicker from 'react-native-google-place-picker';

export default class testPicker extends Component { runPicker() { RNGooglePlacePicker.show((response) => { if (response.didCancel) { console.log('User cancelled GooglePlacePicker'); } else if (response.error) { console.log('GooglePlacePicker Error: ', response.error); } else { console.log('Location', response); this.props.sourceChange(response); } }); } render() { return (

Welcome to React Native! To get started, edit index.android.js Double tap R on your keyboard to reload,{'\n'} Shake or press menu button for dev menu
);

} }

const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, });

AppRegistry.registerComponent('testPicker', () => testPicker);


![image](https://cloud.githubusercontent.com/assets/1377991/20348403/de30c87a-ac37-11e6-9730-f38db481b515.png)
![image](https://cloud.githubusercontent.com/assets/1377991/20348896/6eeaf122-ac3a-11e6-90b9-8e990ef34613.png)

> Logcat

11-16 08:25:58.075 1448 4344 I Places : ?: PlacesBleScanner stop() 11-16 08:25:58.075 1448 1448 I BeaconBle: Client requested to stop, listener=gyy@f19b49e 11-16 08:25:58.075 1448 1448 I BeaconBle: Scan : No clients left, canceling alarm. 11-16 08:26:03.095 1448 1448 I BeaconBle: Scan : No clients left, canceling alarm. 11-16 08:26:07.088 2773 2805 I PlayCommon: [250] com.google.android.play.a.g.e(853): Preparing logs for uploading 11-16 08:26:07.088 2773 2805 I PlayCommon: [250] com.google.android.play.a.g.e(855): No file ready to send 11-16 08:26:10.390 500 1163 W APM::AudioPolicyManager: getOutput() could not find output for stream 1, samplingRate 0,format 0, channels 3, flags 0 11-16 08:26:10.390 500 500 W APM::AudioPolicyManager: getOutput() could not find output for stream 1, samplingRate 0,format 0, channels 3, flags 0 11-16 08:26:10.390 500 901 W APM::AudioPolicyManager: getOutput() could not find output for stream 1, samplingRate 48000,format 1, channels 3, flags 4 11-16 08:26:10.390 815 900 E AudioTrack: Could not get audio output for session 271, stream type -1, usage 13, sample rate 48000, format 0x1, channel mask 0x3, flags 0x4 11-16 08:26:10.391 815 900 E SoundPool: Error creating AudioTrack 11-16 08:26:10.404 4307 4307 D AndroidRuntime: Shutting down VM 11-16 08:26:10.404 4307 4307 E AndroidRuntime: FATAL EXCEPTION: main 11-16 08:26:10.404 4307 4307 E AndroidRuntime: Process: com.testpicker, PID: 4307 11-16 08:26:10.404 4307 4307 E AndroidRuntime: java.lang.AbstractMethodError: abstract method "void com.facebook.react.bridge.ActivityEventListener.onActivityResult(android.app.Activity, int, int, android.content.Intent)" 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:260) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at com.facebook.react.XReactInstanceManagerImpl.onActivityResult(XReactInstanceManagerImpl.java:627) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:135) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.app.Activity.dispatchActivityResult(Activity.java:6428) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:3695) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.app.ActivityThread.-wrap16(ActivityThread.java) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 11-16 08:26:10.404 4307 4307 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 11-16 08:26:10.409 815 1350 W ActivityManager: Force finishing activity com.testpicker/.MainActivity

zhangtaii commented 7 years ago

@spksoft What's the version of react-native and react-native-google-place-picker you are using in the project?

spksoft commented 7 years ago

My "package.json"

{
  "name": "testPicker",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "15.3.2",
    "react-native": "0.37.0",
    "react-native-google-place-picker": "^1.1.2"
  },
  "jest": {
    "preset": "jest-react-native"
  },
  "devDependencies": {
    "babel-jest": "17.0.2",
    "babel-preset-react-native": "1.9.0",
    "jest": "17.0.2",
    "jest-react-native": "17.0.2",
    "react-test-renderer": "15.3.2"
  }
}
zhangtaii commented 7 years ago

Try to update react-native-google-place-picker to latest version, which is 1.2.1.

spksoft commented 7 years ago

Ok, it works !! Thank you so much !!

Mubashirkhan commented 5 years ago

It still does not work for me. I have the latest version of the module.

Screen Shot 2019-04-05 at 5 34 22 PM

and still the same problem

Screenshot_20190405-173601_Google Play services Screenshot_20190405-173636_Samsung Experience Home