react-native-fetch-blob icon indicating copy to clipboard operation
react-native-fetch-blob copied to clipboard

Android build error: cannot find symbol class JavaNetCookieJar

Open mancas opened this issue 6 years ago • 9 comments

First of all, thanks for this amazing library. I've used it before in other projects and works like a charm but I'm starting a freshly ejected react-native app and I'm facing to a few problems.

This is my package.json

{
  "name": "domo4m_v2",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "jest-expo": "^21.0.2",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "main": "index.js",
  "scripts": {
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "expo": "^21.0.0",
    "is-uuid": "^1.0.2",
    "moment": "^2.18.1",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-21.0.0.tar.gz",
    "react-native-elements": "^0.17.0",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-i18n": "^2.0.6",
    "react-native-keyboard-aware-scroll-view": "^0.3.0",
    "react-native-loader": "^1.1.0",
    "react-native-modal": "^4.0.0",
    "react-native-snackbar": "^0.4.1",
    "react-native-swipeout": "^2.2.2",
    "react-native-textinput-effects": "^0.4.1",
    "react-native-vector-icons": "^4.4.0",
    "react-native-video": "^2.0.0",
    "react-navigation": "^1.0.0-beta.13",
    "react-redux": "^5.0.6",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.2.0",
    "uuid": "^3.1.0"
  }
}

So I'm using react native v0.48. The problem is when I try to build the project for Android.

<path>/domo4m_v2/node_modules/react-native-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java
Error:(24, 15) error: cannot find symbol class JavaNetCookieJar
Error:(54, 55) error: incompatible types: expolib_v1.okhttp3.OkHttpClient cannot be converted to okhttp3.OkHttpClient
Error:(57, 46) error: cannot find symbol class JavaNetCookieJar

Error:Execution failed for task ':react-native-fetch-blob:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

The library is linked properly and everything works fine if I remove it.

For more information:

My build.gradle

apply plugin: 'com.android.application'

android {
  compileSdkVersion 25
  buildToolsVersion '25.0.2'

  defaultConfig {
    applicationId "com.d4m.domo4m"
    minSdkVersion 19
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    manifestPlaceholders = [
      'appAuthRedirectScheme': 'com.d4m.domo4m'
    ]
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
  dexOptions {
    javaMaxHeapSize "8g"
  }
}

task exponentPrebuildStep(type: Exec) {
  workingDir '../../'

  if (System.getProperty('os.name').toLowerCase().contains('windows')) {
    commandLine 'cmd', '/c', '.\\.expo-source\\android\\detach-scripts\\prepare-detached-build.bat'
  } else {
    commandLine './.expo-source/android/detach-scripts/prepare-detached-build.sh'
  }
}
preBuild.dependsOn exponentPrebuildStep

repositories{
  flatDir{
    dirs 'libs'
  }
  mavenLocal()
  maven { url 'https://maven.fabric.io/public' }
}

dependencies {
  compile project(':react-native-i18n')
  compile project(':react-native-snackbar')
  compile project(':react-native-video')
  compile project(':react-native-fetch-blob')

  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:appcompat-v7:25.3.1'
  compile 'com.android.support:multidex:1.0.1'

  
  compile('host.exp.exponent:expoview:21.0.0@aar') {
    exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
    exclude group: 'com.facebook.android', module: 'audience-network-sdk'
    exclude group: 'io.nlopez.smartlocation', module: 'library'
    transitive = true;
  }

  compile ('com.facebook.android:facebook-android-sdk:4.+') {
    exclude module: 'bolts-android'
  }
  compile('com.facebook.android:audience-network-sdk:4.+') {
    exclude module: 'play-services-ads'
  }
  compile('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  
  
}

Let me know if I can provide more info

Thanks!

mancas avatar Oct 02 '17 19:10 mancas

It used to work before I upgrade to sdk21 as well, I don't know what happened after upgrading expo but I'm getting the same error as well.

https://github.com/wkh237/react-native-fetch-blob/pull/238

pencilcheck avatar Oct 19 '17 06:10 pencilcheck

Hi! Can you find the solution for this problem yet? I've got this same problem too on windows.

NoerNova avatar Oct 27 '17 14:10 NoerNova

Any update on this issue? I am also facing the same problem, my version of RN is - 0.50.4 and react-native-fetch-blob with version - 0.10.8. I am also facing the same issue with CookieJarContainer.

aniketsingh03 avatar Dec 12 '17 10:12 aniketsingh03

Same issue here.

mauroporras avatar Dec 28 '17 23:12 mauroporras

Also looking for a solution, has this been resolved yet?

CodeShaun avatar Feb 13 '18 12:02 CodeShaun

Any news on this?

alanlanglois avatar Apr 04 '18 12:04 alanlanglois

Same issue here. Any news on this?

proguru58 avatar Apr 26 '18 21:04 proguru58

Same issue any news on this ?

pritasam avatar May 01 '18 07:05 pritasam

You have to change the relevant libraries to the expo libraries.

Here, I have done it for you. https://github.com/HCL-HO/react-native-fetch-blob-expo

HCL-HO avatar Jul 23 '18 07:07 HCL-HO