ExpoKit 33 - package android.support.annotation does not exist.

Hi,

I keep getting the error in android studio for:

error: package android.support.annotation does not exist

This continues to happen in:

…/node_modules/expo-av/android/src/main/java
…/node_modules/expo-gl/android/src/main/java
…/node_modules/expo-image-picker/android/src/main/java

This is my build.gradle


buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal

    }

    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'

    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'devicefarm'

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

android {
    compileSdkVersion 28

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

    defaultConfig {
        applicationId 'com.x.x'
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 114
        versionName '2.1.4'
        ndk {
            // WHEN_DISTRIBUTING_REMOVE_FROM_HERE
            abiFilters 'armeabi-v7a', 'x86'
            // WHEN_DISTRIBUTING_REMOVE_TO_HERE

            /* UNCOMMENT WHEN DISTRIBUTING
            abiFilters 'armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64'
            END UNCOMMENT WHEN DISTRIBUTING */
        }
        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"
    }
    signingConfigs {
        debug {
            storeFile file('../debug.keystore')
        }
        release {
            storeFile file(System.getenv("ANDROID_KEYSTORE_PATH") ?: "release-key.jks")
            storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
            keyAlias System.getenv("ANDROID_KEY_ALIAS")
            keyPassword System.getenv("ANDROID_KEY_PASSWORD")
        }
    }
    buildTypes {
        debug {
            debuggable true
            ext.enableCrashlytics = false
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    lintOptions {
        abortOnError false
    }
    packagingOptions {
        pickFirst "**"
    }
}

devicefarm {
    projectName System.getenv("DEVICEFARM_PROJECT_NAME")
    devicePool System.getenv("DEVICEFARM_DEVICE_POOL")
    executionTimeoutMinutes 40
    authentication {
        accessKey System.getenv("AWS_ACCESS_KEY_ID")
        secretKey System.getenv("AWS_SECRET_ACCESS_KEY")
    }
}

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

// WHEN_PREPARING_SHELL_REMOVE_FROM_HERE
/* UNCOMMENT WHEN DISTRIBUTING
apply from: 'expo.gradle'
END UNCOMMENT WHEN DISTRIBUTING */
// WHEN_PREPARING_SHELL_REMOVE_TO_HERE

apply from: "../../node_modules/react-native-unimodules/gradle.groovy"

dependencies {

    //HUNCH SPECIFICS
    compile project(':react-native-onesignal')
    compile project(':react-native-iap')
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    implementation 'com.amplitude:android-sdk:2.9.2'

    implementation fileTree(dir: 'libs', include: ['*.jar'])

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

    // Our dependencies
    implementation 'com.android.support:appcompat-v7:28.0.0'
    // 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:28.0.0'
    implementation 'com.facebook.android:facebook-android-sdk:5.0.1'
    implementation('com.facebook.android:audience-network-sdk:5.1.1') {
        exclude module: 'play-services-ads'
    }
    compileOnly 'org.glassfish:javax.annotation:3.1.1'
    implementation 'com.jakewharton:butterknife:9.0.0'
    implementation 'de.greenrobot:eventbus:2.4.0'

    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:2.1.0'
    implementation 'commons-io:commons-io:1.4'
    implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    implementation 'commons-codec:commons-codec:1.10'
    implementation 'com.segment.analytics.android:analytics:4.3.0'
    implementation 'com.google.zxing:core:3.3.3'
    implementation 'net.openid:appauth:0.4.1'
    implementation 'com.airbnb.android:lottie:2.5.6'
    implementation('io.nlopez.smartlocation:library:3.2.11') {
        transitive = false
    }
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.squareup.okio:okio:1.9.0'
    implementation 'com.facebook.soloader:soloader:0.6.0'

    // 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:28.0.0'
    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:33.0.0@aar') {
        transitive = true
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
        exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
    }
    addUnimodulesDependencies([
            modulesPaths : [
                    '../../node_modules'
            ],
            configuration: 'api',
            target       : 'react-native',
            exclude      : [
                    // You can exclude unneeded modules here, e.g.,
                    // 'unimodules-face-detector-interface',
                    // Adding a name here will also remove the package
                    // from auto-generated BasePackageList.java
            ]
    ])
}

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

Hey @ohope,

Can you share your app.json file?

Cheers,
Adam

{
  "expo": {
    "sdkVersion": "33.0.0",
    "name": "xxx",
    "slug": "xxx-app",
    "privacy": "public",
    "version": "2.1.4",
    "scheme": "xxx",
    "orientation": "portrait",
    "facebookAppId": "xxxx",
    "facebookDisplayName": "AppName",
    "primaryColor": "#414242",
    "splash": {
      "image": "src/images/splash.png",
      "backgroundColor": "#ff5e4d",
       "resizeMode": "contain"
    },
    "ios": {
      "associatedDomains": [
        "applinks:xxx.app.link"
      ],
      "bundleIdentifier": "xxxx",
      "icon": "src/images/con.png",
      "config": {
        "googleMapsApiKey": "xxx",
        "branch": {
          "apiKey": "xxx"
        }
      },
      "publishBundlePath": "ios/xxx/Supporting/shell-app.bundle",
      "publishManifestPath": "ios/xxx/Supporting/shell-app-manifest.json"
    },
    "android": {
      "versionCode": 114,
      "package": "xxx",
      "icon": "src/images/con_android.png",
      "adaptiveIcon": {
        "foregroundImage": "src/images/icon_android.png",
        "backgroundColor": "#ff5e4d"
      },
      "config": {
        "branch": {
          "apiKey": "xxx"
        },
        "fabric": {
          "apiKey": "xxx",
          "buildSecret": "xxx"
        }
      },
      "googleServicesFile": "android/app/google-services.json",
      "permissions": [
        "MANAGE_DOCUMENTS",
        "READ_EXTERNAL_STORAGE",
        "VIBRATE",
        "WRITE_EXTERNAL_STORAGE",
        "com.anddoes.launcher.permission.UPDATE_COUNT",
        "com.android.launcher.permission.INSTALL_SHORTCUT",
        "com.google.android.c2dm.permission.RECEIVE",
        "com.google.android.gms.permission.ACTIVITY_RECOGNITION",
        "com.google.android.providers.gsf.permission.READ_GSERVICES",
        "com.htc.launcher.permission.READ_SETTINGS",
        "com.htc.launcher.permission.UPDATE_SHORTCUT",
        "com.majeur.launcher.permission.UPDATE_BADGE",
        "com.sec.android.provider.badge.permission.READ",
        "com.sec.android.provider.badge.permission.WRITE",
        "com.sonyericsson.home.permission.BROADCAST_BADGE"
      ],
      "publishBundlePath": "android/app/src/main/assets/shell-app.bundle",
      "publishManifestPath": "android/app/src/main/assets/shell-app-manifest.json"
    },
    "androidStatusBar": {
      "barStyle": "light-content"
    },
    "isDetached": true,
    "detach": {
      "iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.10.2-sdk32.0.0-c59c23cd-1d49-49d2-a633-d03f9d554cf6.tar.gz",
      "androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.10.5-sdk32.0.0-6b87ee30-8cbe-4cc6-b5ba-b03b77e34f90.tar.gz"
    }
  }
}

I have the same issue, Upgrade to Expokit 33