Приложение продолжает останавливаться при запуске после установки response-native-community / geolocation - PullRequest
1 голос
/ 13 июля 2020

Поскольку я установил react-native-community/geolocation, мое приложение продолжает останавливаться при запуске, и я даже не вижу ошибок ни в эмуляторе, ни в консоли. Как это отладить? Все, что я сделал, это запустил npm install @react-native-community/geolocation --save и добавил <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> в AndroidManifest. xml.

Я попытался перезапустить VS Code и весь P C. Я удалил node_modules и снова запустил npm install. Сборка прошла успешно.

Я вернул изменения в состояние до установки, но приложение по-прежнему останавливается. То же самое происходит с эмулятором и физическим устройством.

Редактировать 1: Я удалил репо с диска и снова запустил git clone для своего проекта, что позволило мне запустить мой проект, но все еще без геолокации. Я также пытался установить Agontuk/react-native-geolocation-service, но это вызывает ту же проблему, и возврат изменений не решает этого.

После запуска npm install Agontuk/react-native-geolocation-service и npx react-native run-android я вижу это в консоли, и приложение начинает останавливаться. запустить:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1139 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...

> Task :react-native-community_async-storage:compileDebugJavaWithJavac

> Task :react-native-gesture-handler:compileDebugJavaWithJavac

> Task :react-native-geolocation-service:compileDebugJavaWithJavac

> Task :react-native-reanimated:compileDebugJavaWithJavac

> Task :react-native-screens:compileDebugJavaWithJavac

> Task :app:compileDebugJavaWithJavac
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libfolly_json.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libnative-filters.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libglog_init.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libhermes-inspector.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libflipper.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.

> Task :app:stripDebugDebugSymbols
Compatible side by side NDK version was not found.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libyoga.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libevent-2.1.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libimagepipeline.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libevent_core-2.1.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libimagepipeline.so' due to missing strip tool for ABI 'X86'. 
Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libhermes-executor-release.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libevent_core-2.1.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libfolly_json.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libjsc.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libglog_init.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libjsinspector.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libnative-filters.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libfb.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libjscexecutor.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libflipper.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libfb.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libjscexecutor.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libevent_extra-2.1.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libhermes-executor-release.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libnative-filters.so' due to missing strip tool for ABI 
'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libhermes-executor-release.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libimagepipeline.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libglog_init.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libevent_extra-2.1.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libjsc.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libfb.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libflipper.so' due to missing strip tool for ABI 'X86_64'. 
Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libhermes-executor-debug.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libnative-filters.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libhermes-executor-debug.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libevent-2.1.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libhermes-executor-debug.so' due to missing strip tool for 
ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libnative-imagetranscoder.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libfolly_json.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libreactnativeblob.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libfolly_json.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libyoga.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libglog_init.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libreactnativeblob.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libnative-imagetranscoder.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libfb.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libreactnativeblob.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libhermes-executor-debug.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libyoga.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libjsinspector.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libreactnativejni.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libjscexecutor.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libnative-imagetranscoder.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libreactnativejni.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libyoga.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libjsc.so' due to missing strip tool for ABI 'X86'. Packaging 
it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libhermes-executor-release.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libjsc.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libhermes-inspector.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libfolly_futures.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libfolly_futures.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libevent-2.1.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libjsijniprofiler.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libevent_extra-2.1.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libfolly_futures.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libevent_extra-2.1.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libflipper.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libhermes-inspector.so' due to missing strip tool for 
ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libjsinspector.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libnative-imagetranscoder.so' due to missing strip tool 
for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libfolly_futures.so' due to missing strip tool for ABI 'X86'. 
Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86_64\libevent-2.1.so' due to missing strip tool for ABI 'X86_64'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libevent_core-2.1.so' due to missing strip tool for ABI 
'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libjscexecutor.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libjsinspector.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libreactnativejni.so' due to missing strip tool for ABI 
'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libreactnativejni.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libhermes-inspector.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\armeabi-v7a\libreactnativeblob.so' due to missing strip tool for ABI 'ARMEABI_V7A'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\x86\libevent_core-2.1.so' due to missing strip tool for ABI 'X86'. Packaging it as is.
Unable to strip library 'C:\pathToApp\android\app\build\intermediates\merged_native_libs\debug\out\lib\arm64-v8a\libimagepipeline.so' due to missing strip tool for ABI 'ARM64_V8A'. Packaging it as is.

> Task :app:installDebug
03:52:58 V/ddms: execute: running am get-config
03:52:58 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
03:52:58 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel_3a_API_28(AVD) - 9' for app:debug
03:52:58 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'
03:52:58 D/Device: Uploading file onto device 'emulator-5554'
03:52:58 D/ddms: Reading file permision of C:\pathToApp\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------
03:52:58 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
03:52:59 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
03:52:59 V/ddms: execute: returning
03:52:59 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
03:52:59 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
03:52:59 V/ddms: execute: returning
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 31s
187 actionable tasks: 51 executed, 136 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.appname/.MainActivity }

введите описание изображения здесь

1 Ответ

1 голос
/ 13 июля 2020

Во-первых, Android API> = 23 Требуется дополнительный шаг для проверки . Таким образом, вы должны запросить разрешение ACCESS_FINE_LOCATION, используя PermissionsAndroid API, помимо добавления <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> в файл AndroidManifest.xml. Вы можете запросить разрешение следующим образом:

Добавьте эти строки в файл AndroidManifest.xml.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Тогда код вашего экрана будет таким:

import { View, Text, PermissionsAndroid } from 'react-native';

export default class TestScreen extends React.Component {

  async componentDidMount() {
    try {
      const granted = await PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
        {
          'title': 'Example App',
          'message': 'Example App access to your location '
        }
      )
      if (granted === PermissionsAndroid.RESULTS.GRANTED) {
        console.log("You can use the location")
        alert("You can use the location");
      } else {
        console.log("location permission denied")
        alert("Location permission denied");
      }
    } catch (err) {
      console.warn(err)
    }
  }

  render() {
    return (
      <View>
        <Text>Test Screen</Text>
      </View>
    );
  }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...