Android Expokit Project Fails Gradle Sync


#1

Hello everyone,

I have just ejected my expo project with Expokit. iOS is building and running fine, but my Android project fails gradle sync in Android studio. Any help would be appreciated.

I will first show the error then my config files.

Gradle Sync Fails with the following error:



Failed to resolve: host.exp.exponent:expoview:31.0.0


Unable to resolve dependency for ':app@prodMinSdkDevKernelDebugAndroidTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkDevKernelDebugUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkDevKernelRelease/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkDevKernelReleaseUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkProdKernelDebug/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkProdKernelDebugAndroidTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkProdKernelDebugUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkProdKernelRelease/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@prodMinSdkProdKernelReleaseUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkDevKernelDebug/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkDevKernelDebugAndroidTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkDevKernelDebugUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkDevKernelRelease/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkDevKernelReleaseUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkProdKernelDebug/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkProdKernelDebugAndroidTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkProdKernelDebugUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkProdKernelRelease/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.


Unable to resolve dependency for ':app@devMinSdkProdKernelReleaseUnitTest/compileClasspath': Could not find expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1.

package.json

  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "dependencies": {
    "expo": "^31.0.2",
    "expokit": "^1.3.0",
    "firebase": "^5.0.4",
    "immutable": "^4.0.0-rc.12",
    "moment": "^2.23.0",
    "prettier": "^1.15.3",
    "prop-types": "^15.6.1",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
    "react-native-calendar-datepicker": "^1.2.2",
    "react-native-calendars": "git://github.com/MorganTrudeau/react-native-calendars.git",
    "react-native-hamburger": "0.0.2",
    "react-native-iap": "^2.4.0-betal",
    "react-native-modal-datetime-picker": "^5.1.0",
    "react-native-scroll-into-view": "^0.1.4",
    "react-native-view-overflow": "0.0.3",
    "react-navigation": "^2.0.1",
    "react-navigation-backhandler": "^1.1.1",
    "react-redux": "^5.0.7",
    "react-spinners": "^0.3.2",
    "redux": "^4.0.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "jest-expo": "^28.0.0",
    "redux-mock-store": "^1.5.3"
  },
  "scripts": {
    "test": "node_modules/.bin/jest"
  },
  "jest": {
    "preset": "jest-expo"
  }
}

build.gradle


buildscript {
  repositories {
    google()
    jcenter()
    maven {
      url "https://maven.google.com"
    }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    classpath 'com.google.gms:google-services:3.2.1'
    classpath 'de.undercouch:gradle-download-task:2.0.0'
  }
}

allprojects {
  repositories {
    maven {
      url "https://maven.google.com"
    }
    // For non-detach
    maven {
      url "$rootDir/maven"
    }
    // For old expoviews to work
    maven {
      url "$rootDir/versioned-abis/expoview-abi25_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi26_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi27_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi28_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi29_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi30_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi31_0_0/maven"
    }
    // For detach
    maven {
      url "$rootDir/../node_modules/expokit/maven"
    }
    maven {
      // We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
      url "$rootDir/maven-test"
    }
    google()
    jcenter()
    maven {
      // Local Maven repo containing AARs with JSC built for Android
      url "$rootDir/../node_modules/jsc-android/dist"
    }
    flatDir {
      dirs 'libs'
      // dirs project(':expoview').file('libs')
    }
    maven { url "https://jitpack.io" }

    // Want this last so that we never end up with a stale cache
    mavenLocal()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

app/build.gradle

  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 'com.morgan.test'
    targetSdkVersion 26
    versionCode 1
    versionName '1.0.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 21
    }
  }
  buildTypes {
    debug {
      debuggable true
      ext.enableCrashlytics = false
    }
    release {
      minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      zipAlignEnabled true
    }
  }
  signingConfigs {
    debug {
      storeFile file('../debug.keystore')
    }
  }
  lintOptions {
    abortOnError false
  }
  packagingOptions {
    pickFirst "**"
  }
  configurations.all {
    resolutionStrategy.force 'com.android.support:design:27.1.0'
  }
}


configurations.all {
  resolutionStrategy {
    force 'org.webkit:android-jsc:r224109'
  }
}


apply from: 'expo.gradle'


dependencies {
    compile 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.37.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.okio:okio:1.9.0'
  implementation 'com.facebook.soloader:soloader:0.5.1'

  implementation 'com.google.android.exoplayer:exoplayer:2.6.1'
  implementation 'expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1@aar'

  // expo-file-system
  implementation 'com.squareup.okhttp3:okhttp:3.10.0'
  implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.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:31.0.0@aar') {
    transitive = true
    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
  }
  

}

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

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

#2

Open Preferences, by clicking File > Settings
In left pane, click Build, Execution, Deployment > Gradle
Uncheck the Offline work
Apply changes and sync project again