Ben Hsieh пре 8 година
родитељ
комит
0cf98f2093
2 измењених фајлова са 7 додато и 1 уклоњено
  1. 1
    1
      src/android/build.gradle
  2. 6
    0
      src/scripts/prelink.js

+ 1
- 1
src/android/build.gradle Прегледај датотеку

@@ -34,5 +34,5 @@ android {
34 34
 
35 35
 dependencies {
36 36
     compile 'com.facebook.react:react-native:+'
37
-    compile 'com.squareup.okhttp3:okhttp:3.4.1'
37
+    //{RNFetchBlob_PRE_0.29_DEPDENDENCY}
38 38
 }

+ 6
- 0
src/scripts/prelink.js Прегледај датотеку

@@ -12,6 +12,7 @@ if (!hasNecessaryFile) {
12 12
 var package = JSON.parse(fs.readFileSync(PACKAGE_JSON));
13 13
 var APP_NAME = package.name;
14 14
 var APPLICATION_MAIN = process.cwd() + '/android/app/src/main/java/com/' + APP_NAME.toLocaleLowerCase() + '/MainApplication.java';
15
+var PACKAGE_GRADLE = process.cwd() + '/node_modules/react-native-fetch-blob/android/build.gradle'
15 16
 
16 17
 var VERSION = checkVersion();
17 18
 console.log('RNFetchBlob detected app version .. ' + VERSION);
@@ -28,11 +29,16 @@ if(VERSION >= 0.29) {
28 29
   }
29 30
   main = String(main).replace('new MainReactPackage()', 'new RNFetchBlobPackage(),\n           new MainReactPackage()');
30 31
   main = String(main).replace('import com.facebook.react.ReactApplication;', 'import com.facebook.react.ReactApplication;\nimport com.RNFetchBlob.RNFetchBlobPackage;')
32
+
31 33
   fs.writeFileSync(APPLICATION_MAIN, main);
32 34
   console.log('RNFetchBlob patching MainApplication.java .. ok')
33 35
 
34 36
 }
35 37
 
38
+if(VERSION < 0.27) {
39
+  console.log('You project version is '+ VERSION + 'which does not meet requirement of react-native-fetch-blob 7.0+, please upgrade your application template to react-native 0.27+, otherwise Android application will not working.')
40
+}
41
+
36 42
 // set file access permission for Android < 6.0
37 43
 fs.readFile(MANIFEST_PATH, function(err, data) {
38 44