react-native๋ฅผ ๊ฐ๋ฐํ๋ฉด์ ๋ง์ฃผ์ณค๋ trouble shooting์ ๋ชจ์๋์ ๋ ํฌ์งํ ๋ฆฌ์ ๋๋ค.
$ ./gradlew assembleRelease
...
Execution failed for task ':app:processReleaseResources'.
gradle.properties์ ์๋ ์ฝ๋๋ฅผ ๋ฃ๋๋ค.
android.enableAapt2=false
์ฃผ์์ฌํญ: ํ์ง๋ง android.enableAapt2 ์ต์ ์ 2018๋ ๋ง ์ดํ๋ก deprecated๋๋ค๊ณ ํ๋ ๋์ค์๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์ฐพ์์ผํ ๊ฒ ๊ฐ๋ค.
์ฐธ๊ณ : facebook/react-native#19239
Fatal Exception: java.lang.IllegalStateException: Native module RNDeviceModule tried to override RNDeviceModule for module name RNDeviceInfo. If this was your intention, set canOverrideExistingModule=true
at com.facebook.react.NativeModuleRegistryBuilder.addNativeModule(NativeModuleRegistryBuilder.java:121)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:109)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1050)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1021)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:959)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:802)
at java.lang.Thread.run(Thread.java:818)
MainApplication.java์ protected List getPackages() ๋ถ๋ถ์์ RNDeviceModule์ด ๋ ๋ฒ ๋ค์ด์์ ๊ฒ์ด๋ค.
์ฐธ๊ณ : react-native-device-info/react-native-device-info#243
mobx ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ถ๊ฐํ ๊ฒ์ด ๋ฌธ์ ์ ๋ฐ๋จ์ด์์
JSC๊ฐ ์์ ๋ฒ์ ์ด๋ผ ์๋ฌ๊ฐ ๋๋ ๊ฒ -> JSC๋ฅผ ์ ๋ฐ์ดํธํด์ผ ํ๋ค.
์ ๋ฐ์ดํธ ํ๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ๋ค.
- package.json์ jsc-android ์ถ๊ฐ ํ npm install ํน์ yarn ๋ช ๋ น์ด๋ก ์ค์น
dependencies {
+ "jsc-android": "236355.x.x"
- android/build.gradle์ ๋ค์ ์ฝ๋ ์ถ๊ฐ
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
+ maven {
+ // Local Maven repo containing AARs with JSC library built for Android
+ url "$rootDir/../node_modules/jsc-android/dist"
+ }
}
}
- android/app/build.gradle์ ๋ค์ ์ฝ๋ ์ถ๊ฐ
}
+configurations.all {
+ resolutionStrategy {
+ force 'org.webkit:android-jsc:r236355'
+ }
+}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
- rebuildํ๋ฉด ์ ๋ฐ์ดํธ๋ ๋ฒ์ ์ JSC๋ฅผ ์ฌ์ฉํ ์ ์๋ค.
์ฐธ๊ณ : https://github.com/react-community/jsc-android-buildscripts#how-to-use-it-with-my-react-native-app
์๋๋ก์ด๋์์ ๋น๋ํ๋ฉด ๋ค์ ์๋ฌ ๋ฐ์
Program type already present: com.google.android.gms.internal.measurement.zzwp
ํ์ด์ด๋ฒ ์ด์ค ์ฝ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ต์ ๋ฒ์ ์ผ๋ก ์ฌ๋ฆฌ๋ฉด ๋๋ค.
์๋๋ก์ด๋ ํ์ด์ด๋ฒ ์ด์ค sdk์ ๋ฒ์ ๋ฆฌ์คํธ๋ ์ฌ๊ธฐ๋ฅผ ์ฐธ๊ณ ํ๋ฉด ๋๋ค.
// build.gradle
buildscript {
// others...
ext {
// others...
googlePlayServicesVersion = "16.0.0" // Add this
firebaseVersion = "17.0.0" // Add this
}
}
Pods ํ์ผ์ ์ ๊ฑฐํ๊ณ ์๋ก ์ค์นํ๋ค.
cd ios
rm -rf Pods
pod install
์ฐธ๊ณ : https://stackoverflow.com/questions/50805753/duplicate-module-name-react-native
๋ค์ ๋ช ๋ น์ด๋ฅผ ํ๋ก์ ํธ ๋ฃจํธ ๊ฒฝ๋ก์์ ์คํ
$ cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../
$ cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../
์ฐธ๊ณ : facebook/react-native#21168
CxxBridge, DoubleConversion, Folly, GLog๋ฅผ PodFile์ ์ถ๊ฐ
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'reactTest' do
#Uncomment the next line if you're using Swift or would like to use dynamic frameworks
#use_frameworks!
#Pod react-native
react_native = "../node_modules/react-native"
pod 'React', :path => react_native, :subspecies => [
'Core',
'CxxBridge',
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
]
#Pod yoga support for react-native
pod 'yoga', :path => "#{react_native}/ReactCommon/yoga"
end
์ฐธ๊ณ : facebook/react-native#14925
์บ์๋ฅผ ํด๋ฆฐํด์ผ ํ๋ค.
rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all
# Start Metro Bundler directly
react-native start
์ฐธ๊ณ : facebook/react-native#21490
์ฒซ๋ฒ์งธ ๋ฐฉ๋ฒ: xcode ์ข
๋ฃ ํ, rm -rf ~/Library/Developer/Xcode/DerivedData/*
๋ช
๋ น์ด ์คํ ํ ๋ค์ xcode ์คํ
๋๋ฒ์งธ ๋ฐฉ๋ฒ: RNLocalize.xcodeproj๋ฅผ libraries์์ ์ ๊ฑฐํ ๋ค์ ๋ค์ add fileํ๋ฉด ๋จ
์ฐธ๊ณ : react-native-device-info/react-native-device-info#446 (comment)
mobx ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด decorator๋ฅผ ์ฌ์ฉํด์ผ ํ์๋๋ฐ ๋น๋ ๋์ค ๋ค์ ์๋ฌ๊ฐ ๋ฌ๋ค.
Error build-assets - new decorators proposal is not supported yet. You must pass the"legacy": true option
@babel/plugin-proposal-decorators
๋ฅผ ์ค์น
npm install --save-dev @babel/plugin-proposal-decorators
- tsconfig.json ํ์ผ์ ๋ค์ ๋ผ์ธ์ ์ ๋ ฅ
["@babel/plugin-proposal-decorators", { "legacy": true }],
์ฐธ๊ณ : saleor/saleor#2179
react-native ๊ด๋ จ ํธ๋ฌ๋ธ ์ํ ๊ณต์ ๋ ์ธ์ ๋ ํ์์ ๋๋ค!