question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error: cannot find symbol import com.facebook.react.modules.network.CookieJarContainer;

See original GitHub issue

This all started with the rn-fetch-blob. The error hasnt occured in the previous version of react-native fetch-blob i was using. The solutions available aint helping at all. The Update build.gradle # 623 removes few of the errors. This is the error that shows up when i run react-native run-android `> Task :rn-fetch-blob:compileDebugJavaWithJavac C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:25: error: cannot find symbol import com.facebook.react.modules.network.CookieJarContainer; ^ symbol: class CookieJarContainer location: package com.facebook.react.modules.network C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:28: error: cannot find symbol import okhttp3.JavaNetCookieJar; ^ symbol: class JavaNetCookieJar location: package okhttp3 C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:56: error: incompatible types: com.squareup.okhttp.OkHttpClient cannot be converted to okhttp3.OkHttpClient mClient = OkHttpClientProvider.getOkHttpClient(); ^ C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:58: error: cannot find symbol CookieJarContainer mCookieJarContainer = (CookieJarContainer) mClient.cookieJar(); ^ symbol: class CookieJarContainer location: class RNFetchBlob C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:58: error: cannot find symbol CookieJarContainer mCookieJarContainer = (CookieJarContainer) mClient.cookieJar(); ^ symbol: class CookieJarContainer location: class RNFetchBlob C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:59: error: cannot find symbol mCookieJarContainer.setCookieJar(new JavaNetCookieJar(mCookieHandler)); ^ symbol: class JavaNetCookieJar location: class RNFetchBlob C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:62: error: <anonymous com.RNFetchBlob.RNFetchBlob$1> is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener reactContext.addActivityEventListener(new ActivityEventListener() { ^ C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:63: error: method does not override or implement a method from a supertype @Override ^ C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlob.java:72: error: method does not override or implement a method from a supertype @Override ^ Note: C:\Users\LUTAAYA BRIAN IVAN\BrianExternal\PaX\node_modules\rn-fetch-blob\android\src\main\java\com\RNFetchBlob\RNFetchBlobUtils.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 9 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:rn-fetch-blob: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

BUILD FAILED in 17m 52s 78 actionable tasks: 2 executed, 76 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`

All help is truly appreciated.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
MobileAppVaultcommented, Oct 18, 2018

I’ve fixed the build issue with help of the following tips: https://github.com/wkh237/react-native-fetch-blob/issues/481

Workaround

change imports okhttp3 and okio and use of new okhttp3. to new expolib_v1.okhttp3

import expolib_v1.okhttp3.MediaType;
import expolib_v1.okio.BufferedSink;

I know it’s just a workaround. Do you have any idea how to fix it for the future?

0reactions
MobileAppVaultcommented, Oct 18, 2018

Hi, many thanks for your answer.

This is my android/app/build.gradle after linking rn-fetch.blob and the detailed error description:

android/app/build.gradle

buildscript {
  repositories {
    google()
    maven { url 'https://maven.fabric.io/public' }
  }

  dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
  }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
  maven { url 'https://maven.fabric.io/public' }
}

android {
  compileSdkVersion 27
  buildToolsVersion '27.0.3'

  defaultConfig {
    applicationId 'XXX'
    targetSdkVersion 26
    versionCode 2
    versionName '0.3.0'
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    // Deprecated. Used by net.openid:appauth
    manifestPlaceholders = [
      'appAuthRedirectScheme': 'host.exp.exponent'
    ]
  }
  dexOptions {
    javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
  }

  flavorDimensions 'minSdk', 'remoteKernel'
  productFlavors {
    devKernel {
      dimension 'remoteKernel'
    }
    prodKernel {
      dimension 'remoteKernel'
    }
    devMinSdk {
      dimension 'minSdk'
      // dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
      // to pre-dex each module and produce an APK that can be tested on
      // Android Lollipop without time consuming dex merging processes.
      minSdkVersion 21
    }
    prodMinSdk {
      dimension 'minSdk'
      minSdkVersion 19
    }
  }
  signingConfigs {
    debug {
      storeFile file('../debug.keystore')
    }
    release {
      if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
        storeFile file(MYAPP_RELEASE_STORE_FILE)
        storePassword MYAPP_RELEASE_STORE_PASSWORD
        keyAlias MYAPP_RELEASE_KEY_ALIAS
        keyPassword MYAPP_RELEASE_KEY_PASSWORD
      }
    }
  }
  buildTypes {
    debug {
      debuggable true
      ext.enableCrashlytics = false
    }
    release {
      signingConfig signingConfigs.release
      /*minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'*/
      zipAlignEnabled true
    }
  }
  lintOptions {
    abortOnError false
  }
  packagingOptions {
    pickFirst "**"
  }
}

// Don't use modern jsc-android since it still has some critical bugs that
// crash applications when the string for the JS bundle is loaded and when
// locale-specific date functions are called.
// configurations.all {
//   resolutionStrategy {
//     force 'org.webkit:android-jsc:r216113'
//   }
// }


apply from: 'expo.gradle'


dependencies {
    compile project(':rn-fetch-blob')
  implementation project(':react-native-svg')
  implementation project(':react-native-iap')
  implementation fileTree(dir: 'libs', include: ['*.jar'])

  implementation 'com.android.support:multidex:1.0.1'

  // Our dependencies
  implementation 'com.android.support:appcompat-v7:27.1.1'

  // Our dependencies from ExpoView
  // DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
  implementation 'com.android.support:appcompat-v7:27.1.1'
  implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
  implementation('com.facebook.android:audience-network-sdk:4.99.0') {
    exclude module: 'play-services-ads'
  }
  compileOnly 'org.glassfish:javax.annotation:3.1.1'
  implementation 'com.jakewharton:butterknife:8.4.0'
  implementation 'de.greenrobot:eventbus:2.4.0'
  implementation 'com.amplitude:android-sdk:2.9.2' // Be careful when upgrading! Upgrading might break experience scoping. Check with Jesse. See Analytics.resetAmplitudeDatabaseHelper
  implementation 'com.squareup.picasso:picasso:2.5.2'
  implementation 'com.google.android.gms:play-services-gcm:15.0.1'
  implementation 'com.google.android.gms:play-services-analytics:16.0.1'
  implementation 'com.google.android.gms:play-services-maps:15.0.1'
  implementation 'com.google.android.gms:play-services-auth:15.0.1'
  implementation 'com.google.android.gms:play-services-location:15.0.1'
  implementation 'com.google.android.gms:play-services-ads:15.0.1'
  annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
  implementation "com.raizlabs.android:DBFlow-Core:2.2.1"
  implementation "com.raizlabs.android:DBFlow:2.2.1"
  implementation "com.madgag.spongycastle:core:1.53.0.0"
  implementation "com.madgag.spongycastle:prov:1.53.0.0"
  debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
  // debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
  releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
  implementation 'com.facebook.device.yearclass:yearclass:1.0.1'
  implementation 'commons-io:commons-io:1.3.2'
  implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
  implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
  implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
  implementation 'com.yqritc:android-scalablevideoview:1.0.1'
  implementation 'commons-codec:commons-codec:1.10'
  implementation 'com.segment.analytics.android:analytics:4.3.0'
  implementation 'com.google.zxing:core:3.2.1'
  implementation 'net.openid:appauth:0.4.1'
  implementation('com.airbnb.android:lottie:2.5.5')  {
      exclude group: 'com.android.support', module: 'appcompat-v7'
  }
  implementation 'io.branch.sdk.android:library:2.17.1'
  implementation('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  implementation 'com.android.support:exifinterface:27.1.1'
  implementation 'com.squareup.okhttp3:okhttp:3.4.1'
  implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
  implementation 'com.squareup.okhttp3:okhttp-ws:3.4.1'
  implementation 'com.squareup.okio:okio:1.9.0'

  // Testing
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  // We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
  androidTestImplementation 'com.android.support.test:runner:1.0.1'
  androidTestImplementation 'com.android.support:support-annotations:27.1.1'
  androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
  androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
  androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'

  testImplementation 'junit:junit:4.12'
  testImplementation 'org.mockito:mockito-core:1.10.19'
  testImplementation 'org.robolectric:robolectric:3.8'
  testImplementation 'com.android.support.test:runner:1.0.2-alpha1'
  testImplementation 'com.android.support.test:rules:1.0.2-alpha1'

  
  implementation('host.exp.exponent:expoview:29.0.0@aar') {
    transitive = true
    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
  }
  
  /* REMOVED_WHEN_DISTRIBUTING_FROM_HERE
  implementation(project(path: ':expoview')) {
    // Excluding okhttp3 included by expo-file-system
    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
  }
  REMOVED_WHEN_DISTRIBUTING_TO_HERE */

}

// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'

Detail Error from Android Studio

/Users/.../node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java:28: error: cannot find symbol
import okhttp3.JavaNetCookieJar;
              ^
  symbol:   class JavaNetCookieJar
  location: package okhttp3
/Users/.../node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java:56: error: incompatible types: expolib_v1.okhttp3.OkHttpClient cannot be converted to okhttp3.OkHttpClient
        mClient = OkHttpClientProvider.getOkHttpClient();
                                                      ^
/Users/.../node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java:59: error: cannot find symbol
        mCookieJarContainer.setCookieJar(new JavaNetCookieJar(mCookieHandler));
                                             ^
  symbol:   class JavaNetCookieJar
  location: class RNFetchBlob
Note: /Users/.../node_modules/react-native-iap/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/.../node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java:737: error: method sslSocketFactory in class Builder cannot be applied to given types;
                client.sslSocketFactory(sslSocketFactory, trustManager);
                      ^
  required: SSLSocketFactory
  found: SSLSocketFactory,X509TrustManager
  reason: actual and formal argument lists differ in length
4 errors
:rn-fetch-blob:compileDebugJavaWithJavac FAILED
Read more comments on GitHub >

github_iconTop Results From Across the Web

React native: error: cannot find symbol after upgrade
First: install all dependencies using yarn or npm;. Second: use the code below to link native dependencies on iOS and Android native code;...
Read more >
error: package com.facebook.react.bridge does not exist
/node_modules/react-native-workers/android/src/main/java/co/apptailor/Worker/core/ReactContextBuilder.java:7: error: cannot find symbol import ...
Read more >
How to Resolve The Cannot Find Symbol Error in Java - Rollbar
The cannot find symbol error refers to a situation where the Java compiler is unable to find the symbol associated with a given...
Read more >
React-Native-FS Compiling Error - Super User
if you are using RN +0.40, follow step below instead docs step "register module (in MainActivity.java)" go in MainApplication.java
Read more >
cannot resolve symbol react-native
error cannot find symbol import com reactnative imagepicker pickerpackage ... Native modules can also fulfill a promise, which can simplify your JavaScript, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found