I recently created a new project using npx react-native init myapp --template react-native-template-typescript, everything is working in android, but when I try to build for iOS, the build fails due to React-Codegen errors specifically in FBReactNativeSpec.h file. Below is the build error output from xcode:
Whole log:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
/Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:2206:46: error: 'value' is unavailable: introduced in iOS 12.0
d[#"window"] = window.has_value() ? window.value().buildUnsafeRawValue() : nil;
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:19:
In file included from /Users/macbookair/Desktop/justChat/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
constexpr value_type& value() &
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
/Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:2208:46: error: 'value' is unavailable: introduced in iOS 12.0
d[#"screen"] = screen.has_value() ? screen.value().buildUnsafeRawValue() : nil;
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:19:
In file included from /Users/macbookair/Desktop/justChat/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
constexpr value_type& value() &
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
/Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:2210:88: error: 'value' is unavailable: introduced in iOS 12.0
d[#"windowPhysicalPixels"] = windowPhysicalPixels.has_value() ? windowPhysicalPixels.value().buildUnsafeRawValue() : nil;
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:19:
In file included from /Users/macbookair/Desktop/justChat/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
constexpr value_type& value() &
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
/Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:2212:88: error: 'value' is unavailable: introduced in iOS 12.0
d[#"screenPhysicalPixels"] = screenPhysicalPixels.has_value() ? screenPhysicalPixels.value().buildUnsafeRawValue() : nil;
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:19:
In file included from /Users/macbookair/Desktop/justChat/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
constexpr value_type& value() &
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
/Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:2223:96: error: 'value' is unavailable: introduced in iOS 12.0
d[#"isIPhoneX_deprecated"] = isIPhoneX_deprecated.has_value() ? #((BOOL)isIPhoneX_deprecated.value()) : nil;
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:19:
In file included from /Users/macbookair/Desktop/justChat/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
constexpr value_type& value() &
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
/Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:2462:68: error: 'value' is unavailable: introduced in iOS 12.0
d[#"prerelease"] = prerelease.has_value() ? #((double)prerelease.value()) : nil;
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:19:
In file included from /Users/macbookair/Desktop/justChat/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
constexpr value_type& value() &
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
/Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:2588:110: error: 'value' is unavailable: introduced in iOS 12.0
d[#"DEFAULT_BACKGROUND_COLOR"] = DEFAULT_BACKGROUND_COLOR.has_value() ? #((double)DEFAULT_BACKGROUND_COLOR.value()) : nil;
^
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm:14:
In file included from /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h:19:
In file included from /Users/macbookair/Desktop/justChat/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
constexpr value_type& value() &
^
7 errors generated.
** BUILD FAILED **
The following build commands failed:
CompileC /Users/macbookair/Library/Developer/Xcode/DerivedData/justChat-gvlyyuoxvfahekfvnoiuaatjtplq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Objects-normal/x86_64/FBReactNativeSpec-generated.o /Users/macbookair/Desktop/justChat/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
What I tried so far:
delete podfile.lock, cd ios && pod install
clean build and then yarn ios
commented !use_flipper() from Podfile then clean build.
My config:
macOS Catalina
version 10.15.7
XCode 12.4
As mentioned in the image, it is related to React-Codegen and it is in newer version of react-native-0.69.1, so can anyone help me fix this issue in ios?
The problem is about IPHONEOS_DEPLOYMENT_TARGET so it should be fixed as mentioned in this link https://github.com/facebook/react-native/issues/34106
In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
Related
% npx react-native run-android Starting JS server... Building and
installing the app on the device (cd android && ./gradlew
installDebug)...
Configure project :react-native-reanimated WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below
the minimum supported version (29.0.2) for Android Gradle Plugin
4.1.0. Android SDK Build Tools 29.0.2 will be used. To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle
file, as each version of the Android Gradle Plugin now has a default
version of the build tools. Warning: Mapping new ns
http://schemas.android.com/repository/android/common/02 to old ns
http://schemas.android.com/repository/android/common/01 Warning:
Mapping new ns
http://schemas.android.com/repository/android/generic/02 to old ns
http://schemas.android.com/repository/android/generic/01 Warning:
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02
to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns
http://schemas.android.com/sdk/android/repo/repository2/02 to old ns
http://schemas.android.com/sdk/android/repo/repository2/01 Warning:
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02
to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Configure project :react-native-linear-gradient WARNING: Configuration 'provided' is obsolete and has been replaced with
'compileOnly'. It will be removed in version 5.0 of the Android Gradle
plugin. For more information, see
http://d.android.com/r/tools/update-dependency-configurations.html.
Configure project :react-native-orientation WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and
'api'. It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see
http://d.android.com/r/tools/update-dependency-configurations.html.
Configure project :app WARNING: The option 'android.useDeprecatedNdk' is deprecated. The current default is
'false'. It has been removed from the current version of the Android
Gradle plugin. NdkCompile is no longer supported WARNING:
Configuration 'compile' is obsolete and has been replaced with
'implementation' and 'api'. It will be removed in version 5.0 of the
Android Gradle plugin. For more information, see
http://d.android.com/r/tools/update-dependency-configurations.html.
WARNING: API 'variant.getMergeResources()' is obsolete and has been
replaced with 'variant.getMergeResourcesProvider()'. It will be
removed in version 5.0 of the Android Gradle plugin. For more
information, see
https://d.android.com/r/tools/task-configuration-avoidance. To
determine what is calling variant.getMergeResources(), use
-Pandroid.debug.obsoleteApi=true on the command line to display more information. WARNING: API 'variant.getPackageApplication()' is
obsolete and has been replaced with
'variant.getPackageApplicationProvider()'. It will be removed in
version 5.0 of the Android Gradle plugin. For more information, see
https://d.android.com/r/tools/task-configuration-avoidance. To
determine what is calling variant.getPackageApplication(), use
-Pandroid.debug.obsoleteApi=true on the command line to display more information. WARNING: API 'variant.getMergeAssets()' is obsolete and
has been replaced with 'variant.getMergeAssetsProvider()'. It will be
removed in version 5.0 of the Android Gradle plugin. For more
information, see
https://d.android.com/r/tools/task-configuration-avoidance. To
determine what is calling variant.getMergeAssets(), use
-Pandroid.debug.obsoleteApi=true on the command line to display more information.
Task :app:compileDebugJavaWithJavac FAILED /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:9:
Error: Packagecom.reactnativecommunity.webview does not exist import
com.reactnativecommunity.webview.RNCWebViewPackage;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:18:
Error: Packagecom.beefe.picker does not exist import
com.beefe.picker.PickerViewPackage;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:28:
Error: Packagecom.reactnativenavigation does not exist import
com.reactnativenavigation.NavigationApplication;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:29:
Error: Packagecom.reactnativenavigation.react does not exist import
com.reactnativenavigation.react.NavigationReactNativeHost;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:30:
Error: Packagecom.reactnativenavigation.react does not exist import
com.reactnativenavigation.react.ReactGateway;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:36:
Error: Symbol not found public class MainApplication extends
NavigationApplication {
^ シンボル: Class NavigationApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:45:
Error: Symbol not found
protected ReactGateway createReactGateway() {
^ シンボル: Class ReactGateway 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:8:
Error: Packageandroid.support.annotation does not exist import
android.support.annotation.Nullable;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:12:
Error: Packagecom.reactnativenavigation does not exist import
com.reactnativenavigation.NavigationActivity;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:18:
Error: Symbol not found public class MainActivity extends
NavigationActivity {
^ シンボル: Class NavigationActivity /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:21:
Error: Symbol not found
protected void onCreate(#Nullable Bundle savedInstanceState) {
^ シンボル: Class Nullable 場所: Class MainActivity
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:44:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:46:
Error: Symbol not found
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
^ シンボル: Class NavigationReactNativeHost 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:47:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:52:
Error: Symbol not found
return new ReactGateway(this, isDebug(), host);
^ シンボル: Class ReactGateway 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:55:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:68:
Error: Symbol not found
new PickerViewPackage(),
^ シンボル: Class PickerViewPackage 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:70:
Error: Class FBSDKPackageのコンストラクタ FBSDKPackageは指定された型に適用できません。
new FBSDKPackage(mCallbackManager),
^ 期待値: 引数がありません 検出値: CallbackManager 理由: 実引数リストと仮引数リストの長さが異なります
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:72:
Error: Symbol not found
new RNCWebViewPackage(),
^ シンボル: Class RNCWebViewPackage 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:79:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:20:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:22:
Error: Symbol not found
super.onCreate(savedInstanceState);
^ シンボル: 変数 super 場所: Class MainActivity /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:26:
Error: Symbol not found
PackageInfo info = getPackageManager().getPackageInfo(
^ シンボル: メソッド getPackageManager() 場所: Class MainActivity
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:48:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:50:
Error: Symbol not found
super.onActivityResult(requestCode, resultCode, data);
^ シンボル: 変数 super 場所: Class MainActivity ノート:/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.javaは推奨されないAPIを使用またはオーバーライドしています。
ノート:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。 Error25個
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
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
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation
warnings and determine if they come from your own scripts or plugins.
See
https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s 145 actionable tasks: 2 executed, 143 up-to-date
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 installDebug
Error: Command failed: ./gradlew installDebug
at checkExecSyncError (node:child_process:707:11)
at Object.execFileSync (node:child_process:726:15)
at runOnAllDevices (/Users/tenna/Downloads/aitem/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
at buildAndRun (/Users/tenna/Downloads/aitem/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
at /Users/tenna/Downloads/aitem/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12
at processTicksAndRejections (node:internal/process/task_queues:96:5)
click on android folder
click on app folder
click on src folder
click on java folder
click on MainApplication.java file and remove Packagecom.reactnativecommunity.webview in line 9
use latest updated one
npm i react-native-webview
I want to use:
co_await winrt::resume_foreground(window.DispatcherQueue());
(Type of "window" is: "winrt::Microsoft::UI::Xaml::Window")
But I cannot compile it because
winrt::resume_foreground(Microsoft::System::DispatcherQueue const& dispatcher)
is not defined.
I cannot include #include <winrt/Microsoft.System.h> which contains the DispatcherQueue class.
My environment:
Windows 10 Pro, 21H1, 19043.1083
Visual Studio Community 2019 (16.10.3)
Visual Studio Extension: Project Reunion Version 0.8.0.46122163
Project Template: C++, Blank App, Packaged (WinUI 3 in Desktop)
To reproduce the error I used the Project Template above and added the following method to the "App" class.
App.xaml.h
winrt::Windows::Foundation::IAsyncAction foo();
App.xaml.cpp
winrt::Windows::Foundation::IAsyncAction App::foo()
{
co_await winrt::resume_foreground(window.DispatcherQueue());
}
I get the error message:
D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,21): error C2039: 'resume_foreground': is not a member of 'winrt'
1>D:\Solution\WinUi3 Test\WinUi3 Test\MainWindow.xaml.h(23): message : see declaration of 'winrt'
1>D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,38): error C3861: 'resume_foreground': identifier not found
1>Done building project "WinUi3 Test.vcxproj" -- FAILED.
If I try to include #include <winrt/Microsoft.System.h> I get:
1>D:\Solution\WinUi3 Test\WinUi3 Test\pch.h(25,10): fatal error C1083: Cannot open include file: 'winrt/Microsoft.System.h': No such file or directory
1>Done building project "WinUi3 Test.vcxproj" -- FAILED.
If I include #include <winrt/Windows.System.h> and #include <winrt/Windows.UI.Core.h> I get:
1>D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,63): error C2665: 'winrt::resume_foreground': none of the 2 overloads could convert all the argument types
1>D:\Solution\WinUi3 Test\WinUi3 Test\Generated Files\winrt\Windows.UI.Core.h(2805,31): message : could be 'winrt::resume_foreground::awaitable winrt::resume_foreground(const winrt::Windows::UI::Core::CoreDispatcher &,const winrt::Windows::UI::Core::CoreDispatcherPriority) noexcept' (compiling source file App.xaml.cpp)
1>D:\Solution\WinUi3 Test\WinUi3 Test\Generated Files\winrt\Windows.System.h(4529,31): message : or 'winrt::resume_foreground::awaitable winrt::resume_foreground(const winrt::Windows::System::DispatcherQueue &,const winrt::Windows::System::DispatcherQueuePriority) noexcept' (compiling source file App.xaml.cpp)
1>D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,63): message : while trying to match the argument list '(winrt::Microsoft::UI::Dispatching::DispatcherQueue)'
1>Done building project "WinUi3 Test.vcxproj" -- FAILED.
Include
#include <winrt/Microsoft.UI.Dispatching.h>
#include <Microsoft.UI.Dispatching.co_await.h>
When updating from 0.8.0 preview to 0.8.0 there was a namespace change from
Microsoft.System to Microsoft.UI.Dispatching and resume_foreground is now defined in Microsoft.UI.Dispatching.co_await.h.
The answer from Markus does not work for me in the WinUI3 1.0 release because the Microsoft.UI.Dispatching.co_await.h header file does not exist. However, the following does work:
#include <wil/cppwinrt.h>
#include <wil/cppwinrt_helpers.h>
co_await wil::resume_foreground(DispatcherQueue());
I am trying to use https://github.com/react-native-community/react-native-webview.
I get this error when I try and react-native run-android, any ideas how I can use webview?
\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:54: error: package com.reactnativecommunity.webview.events does not exist
Using:
react-native-cli: 2.0.1
react-native: 0.57.1
error in full:
Task :react-native-webview:compileDebugJavaWithJavac
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:54: error: package com.reactnativecommunity.webview.events does not exist
import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
^
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:55: error: package com.reactnativecommunity.webview.events does not exist
import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
^
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:56: error: package com.reactnativecommunity.webview.events does not exist
import com.reactnativecommunity.webview.events.TopLoadingProgressEvent;
^
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:57: error: package com.reactnativecommunity.webview.events does not exist
import com.reactnativecommunity.webview.events.TopLoadingStartEvent;
^
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:58: error: package com.reactnativecommunity.webview.events does not exist
import com.reactnativecommunity.webview.events.TopMessageEvent;
^
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:59: error: package com.reactnativecommunity.webview.events does not exist
import com.reactnativecommunity.webview.events.TopShouldStartLoadWithRequestEvent;
^
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:455: error: cannot find symbol
export.put(TopLoadingProgressEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingProgress"));
^
symbol: variable TopLoadingProgressEvent
location: class RNCWebViewManager
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:456: error: cannot find symbol
export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest"));
^
symbol: variable TopShouldStartLoadWithRequestEvent
location: class RNCWebViewManager
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:457: error: method getJSEventName in enum ScrollEventType cannot be applied to given types;
export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll"));
^
required: no arguments
found: ScrollEventType
reason: actual and formal argument lists differ in length
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:732: error: cannot find symbol
new TopLoadingProgressEvent(
^
symbol: class TopLoadingProgressEvent
location: class RNCWebChromeClient
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:617: error: cannot find symbol
new TopLoadingStartEvent(
^
symbol: class TopLoadingStartEvent
location: class RNCWebViewClient
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:626: error: cannot find symbol
new TopShouldStartLoadWithRequestEvent(
^
symbol: class TopShouldStartLoadWithRequestEvent
location: class RNCWebViewClient
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:659: error: cannot find symbol
new TopLoadingErrorEvent(webView.getId(), eventData));
^
symbol: class TopLoadingErrorEvent
location: class RNCWebViewClient
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:665: error: cannot find symbol
new TopLoadingFinishEvent(
^
symbol: class TopLoadingFinishEvent
location: class RNCWebViewClient
C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:901: error: cannot find symbol
dispatchEvent(this, new TopMessageEvent(this.getId(), message));
^
symbol: class TopMessageEvent
location: class RNCWebView
Note: C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
15 errors
Task :react-native-webview:compileDebugJavaWithJavac FAILED
This issue happened to me
i had these versions of react-native and react-native-webview version
"react-native-webview": "^5.12.1"
{
"react": "16.8.3",
"react-native": "0.59.9",
"react-native-webview": "^5.12.1",
...
}
Everything was fine for my previous version of project nothing happned with this version.
After updating android-studio and upgrade the gradle, i freshly build and run the same project (after i clone the same project from my github repo.). This issue occured, then i put and checked each new version (above 5.12.1) of react-native-webview. Finally, it matched, fixed the error and successfully build the app with this version.
"react-native-webview": "^7.5.2"
{
"react": "16.8.3",
"react-native": "0.59.9",
"react-native-webview": "^7.5.2",
...
}
click node_modules folder
delete react-native-webview folder
install latest one npm i react-native-webview
The module can be find Here
I think maybe some dependencies errors occured,anyone who has an idea will be great~
What I find important is
lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed
The whole list as follow:
imatrix#Zero:~/下载/GNU/ 模块/gr-mediatools-master/build$ make -j4
Scanning dependencies of target mediatools_swig_swig_doc
Scanning dependencies of target pygen_python_aead6
Scanning dependencies of target pygen_apps_9a6dd
Scanning dependencies of target gnuradio-mediatools
[ 0%] Built target mediatools_swig_swig_doc
[ 5%] Generating __init__.pyc
[ 5%] Built target pygen_apps_9a6dd
Scanning dependencies of target _mediatools_swig_swig_tag
[ 11%] Generating __init__.pyo
[ 17%] Building CXX object swig/CMakeFiles/_mediatools_swig_swig_tag.dir/_mediatools_swig_swig_tag.cpp.o
[ 23%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_s.cc.o
[ 29%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o
[ 35%] Linking CXX executable _mediatools_swig_swig_tag
[ 35%] Built target pygen_python_aead6
[ 35%] Built target _mediatools_swig_swig_tag
[ 41%] Generating mediatools_swig.tag
Scanning dependencies of target mediatools_swig_swig_2d0df
[ 47%] Building CXX object swig/CMakeFiles/mediatools_swig_swig_2d0df.dir/mediatools_swig_swig_2d0df.cpp.o
[ 52%] Linking CXX executable mediatools_swig_swig_2d0df
Swig source
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘bool mediatools_audiosource_impl::open(std::__cxx11::string)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘void mediatools_audiosource_impl::readData(std::vector<short int>&)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
d_frame = avcodec_alloc_frame();
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:79: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed
make[2]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o] Error 1
make[2]: *** 正在等待未完成的任务....
[ 52%] Built target mediatools_swig_swig_2d0df
Scanning dependencies of target pygen_swig_d4ca7
[ 64%] Generating mediatools_swig.pyc
[ 64%] Generating mediatools_swig.pyo
[ 70%] Built target pygen_swig_d4ca7
CMakeFiles/Makefile2:135: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/all' failed
make[1]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Your error stems from here:
gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
d_frame = avcodec_alloc_frame();
That's because avcodec_alloc_frame has been deprecated in recent versions of ffmpeg. The gr-mediatools repository is quite old now.
Replacing avcodec_alloc_frame with av_frame_alloc in lib/mediatools_audiosource_impl.cc on line 91 might just do the trick.
i encounter an error like
Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x2C8 C:\Program Files\OpenCV\bin\highgui110.dll
Additional Include Directories
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cv\include
Additional Library Directories
C:\Program Files\OpenCV\otherlibs
C:\Program Files\OpenCV\lib
C:\Program Files\OpenCV\bin
Additional Dependencies
cv.lib
highgui.lib
cxcore.lib
highgui110.dll
Error Message is
Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x2C8 C:\Program Files\OpenCV\bin\highgui110.dll 1 OpenCV Capture
What wrong with highgui.dll ?
Please help.
Thanks.
This is my source code.
Code:
#ifndef CAM_CAPTURE_H
#define CAM_CAPTURE_H
#include "cv.h"
#include "highgui.h"
class CamCapture
{
private:
CvCapture* myCaptureHandler;
IplImage* videoFrame;
int key;
public:
CamCapture();
~CamCapture();
void Init();
};
#endif
Remove highgui110.dll from your list of Additional dependencies. In additional dependencies you should list only lib files.