React Native Project 不会在 expo 或 avd 上构建



我刚刚得到了一个React Native Project,我正在尝试运行它。当我运行时: react-native run-android,这是我的输出。

Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Checking the license for package Android SDK Platform 27 in C:UsersoriontAppDataLocalAndroidSdklicenses
Warning: License for package Android SDK Platform 27 not accepted.

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-27 Android SDK Platform 27
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
  Using Android SDK: C:UsersoriontAppDataLocalAndroidSdk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
    at checkExecSyncError (child_process.js:637:11)
    at Object.execFileSync (child_process.js:655:13)
    at runOnAllDevices (C:Usersoriontdevprojnode_modulesreact-nativelocal-clirunAndroidrunAndroid.js:299:19)
    at buildAndRun (C:Usersoriontdevprojnode_modulesreact-nativelocal-clirunAndroidrunAndroid.js:135:12)
    at isPackagerRunning.then.result (C:Usersoriontdevprojnode_modulesreact-nativelocal-clirunAndroidrunAndroid.js:65:12)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

我遵循了Facebook入门页面上的所有指示,但是此错误不断弹出。当我运行它时,我的AVD运行(在Android 9上)。从那里,我尝试接受许可证。

C:UsersoriontAppDataLocalAndroidSdktoolsbin>sdkmanager.bat --licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 5 more

我不知道该怎么办。我尝试了博览会,那是另一个兔子洞...有人请帮忙!谢谢!

Android Studio>首选项>外观&amp;行为>系统设置> Android SDK

勾选最新的Android版本,单击"应用"。

在这一点上,Android会要求您同意其许可证,并将安装更新的版本。

从这里github

我读了一个答案(谢谢),但可悲的是行不通。我现在认为许可不再是问题所在。我已经意识到该项目想要Android 27,并且安装了Android 28,因此我尝试将降级到Android 27.这不起作用,所以我只是通过更改Android/build的Ext,将该项目升级为Android 28.gradle至:

ext {
    buildToolsVersion = "28.0.0"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 26
    supportLibVersion = "28.0.0"
}

并将其添加到Android/app/build.gradle

中的Android中
packagingOptions {
   pickFirst 'lib/x86/libc++_shared.so'
   pickFirst 'lib/x86_64/libjsc.so'
   pickFirst 'lib/arm64-v8a/libjsc.so'
   pickFirst 'lib/arm64-v8a/libc++_shared.so'
   pickFirst 'lib/x86_64/libc++_shared.so'
   pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}

我还安装了Java 10.0.2,然后降级到Java8。(不确定这是否有所作为)

无论如何,我希望这可以帮助人们最新的旧项目!

相关内容

  • 没有找到相关文章

最新更新