title: React Native: error package android.support.annotation does not exist
body: <p>The error is thrown by </p>
  
  <blockquote>
    <p>Task :react-native-camera:compileGeneralReleaseJavaWithJavac FAILED</p>
  </blockquote>
  
  <p>The errors are slightly different but all have that caret pointing to a package that doesn't exist. Around 100 more exist after it that are very similar:
  <a href="https://i.stack.imgur.com/u4Nnb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u4Nnb.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/SJu6Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SJu6Z.png" alt="enter image description here"></a></p>
  
  <p>I had a RN v0.57 project that needs to be updated in order to go on the play store and after trying to upgrade directly I started seeing errors that google had never seen before so I opted instead to make a new project and port over my src folder and relevant package.json data.</p>
  
  <p>Figured it might take me one week to fix all the errors that way instead of the month I'd expect chasing errors introduced by the upgrade, based on past experience. I've fixed about a dozen earlier bugs before getting stuck on this one so I can't be certain the fixes there didn't introduce this one but thinking like that will get you no progress at all so here I find myself.</p>
  
  <p>I have read a little bit about androidx either being related to this or a possible fix but the last thing I want to do is start introducing new things that can go wrong. The code base was fine and worked in 0.57, I just want to upgrade it to the latest, get it up on the store, and never look at react native again.</p>
  
  <p>This is my package.json:</p>
  
  <pre><code>{
    "name": "(Projectname)",
    "version": "0.0.1",
    "private": true,
    "scripts": {
      "android": "react-native run-android",
      "ios": "react-native run-ios",
      "start": "react-native start",
      "test": "jest",
      "lint": "eslint ."
    },
    "dependencies": {
      "@babel/runtime": "^7.1.2",
      "@react-native-community/cli-platform-android": "^2.9.0",
      "@svgr/core": "^4.2.0",
      "axios": "^0.18.0",
      "date-fns": "^1.30.1",
      "link": "^0.1.5",
      "moment": "^2.24.0",
      "pod-installer": "0.0.0",
      "qs": "^6.5.2",
      "react": "16.9.0",
      "react-moment": "^0.8.4",
      "react-native": "0.61.4",
      "react-native-action-picker": "^1.0.2",
      "react-native-action-sheet": "^2.2.0",
      "react-native-android-log": "^1.1.0",
      "react-native-button": "^2.3.0",
      "react-native-cached-image": "^1.4.3",
      "react-native-calendar-picker": "^6.0.0",
      "react-native-camera": "^2.11.0",
      "react-native-communications": "^2.2.1",
      "react-native-date-picker": "^2.3.0",
      "react-native-document-picker": "^2.1.0",
      "react-native-fetch-blob": "^0.10.8",
      "react-native-fit-image": "^1.5.4",
      "react-native-fontawesome": "^6.0.1",
      "react-native-fs": "^2.13.2",
      "react-native-gesture-handler": "^1.0.17",
      "react-native-image-crop-picker": "^0.22.0",
      "react-native-lazyload-deux": "^2.0.4",
      "react-native-photo-editor": "^1.0.0",
      "react-native-responsive-grid": "^0.41.992",
      "react-native-router-flux": "^4.0.0-beta.31",
      "react-native-simple-toast": "0.0.8",
      "react-native-splash-screen": "^3.2.0",
      "react-native-svg": "^9.3.7",
      "react-native-tab-view": "0.0.74",
      "react-native-web-swiper": "^1.15.1",
      "react-navigation": "^3.3.0",
      "react-navigation-stack": "^1.0.10",
      "react-redux": "^5.0.7",
      "redux": "^4.0.0",
      "redux-persist": "^5.10.0",
      "redux-thunk": "^2.3.0",
      "semver": "^6.0.0",
      "uuid": "^3.3.2"
    },
    "devDependencies": {
      "babel-jest": "23.6.0",
      "babel-core": "^7.0.0-bridge.0",
      "jest": "23.6.0",
      "metro-react-native-babel-preset": "0.47.0",
      "react-native-svg-transformer": "^0.12.1",
      "react-test-renderer": "16.6.3"
    },
    "jest": {
      "preset": "react-native"
    },
    "rnpm": {
      "assets": [
        "./src/fonts"
      ]
    }
  }
  </code></pre>
  
  <p>My Android\app\build.gradle:</p>
  
  <pre><code>android {
      compileSdkVersion rootProject.ext.compileSdkVersion
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      defaultConfig {
          applicationId "com.projectname"
          minSdkVersion rootProject.ext.minSdkVersion
          targetSdkVersion rootProject.ext.targetSdkVersion
          versionCode 1
          versionName "1.0"
          missingDimensionStrategy 'react-native-camera', 'general' (this was a fix I found and tried but hasn't helped)
      }
      splits {
          abi {
              reset()
              enable enableSeparateBuildPerCPUArchitecture
              universalApk false  // If true, also generate a universal APK
              include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
          }
      }
      signingConfigs {
          debug {
              storeFile file('debug.keystore')
              storePassword 'android'
              keyAlias 'androiddebugkey'
              keyPassword 'android'
          }
      }
      buildTypes {
          debug {
              signingConfig signingConfigs.debug
          }
          release {
              // Caution! In production, you need to generate your own keystore file.
              // see https://facebook.github.io/react-native/docs/signed-apk-android.
              signingConfig signingConfigs.debug
              minifyEnabled enableProguardInReleaseBuilds
              proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
          }
      }
      // applicationVariants are e.g. debug, release
      applicationVariants.all { variant -&gt;
          variant.outputs.each { output -&gt;
              // For each separate APK per architecture, set a unique version code as described here:
              // https://developer.android.com/studio/build/configure-apk-splits.html
              def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
              def abi = output.getFilter(OutputFile.ABI)
              if (abi != null) {  // null for the universal-debug, universal-release variants
                  output.versionCodeOverride =
                          versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
              }
  
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: "libs", include: ["*.jar"])
      implementation "com.facebook.react:react-native:+"  // From node_modules
      implementation "com.google.android.gms:play-services-gcm:12.+" 
      implementation 'com.android.support:appcompat-v7:28.0.0'
      androidTestImplementation "com.android.support:support-annotations:28.0.0"
  
      if (enableHermes) {
          def hermesPath = "../../node_modules/hermes-engine/android/";
          debugImplementation files(hermesPath + "hermes-debug.aar")
          releaseImplementation files(hermesPath + "hermes-release.aar")
      } else {
          implementation jscFlavor
      }
  }
  
  // Run this once to be able to run the application with BUCK
  // puts all compile dependencies into folder libs for BUCK to use
  task copyDownloadableDepsToLibs(type: Copy) {
      from configurations.compile
      into 'libs'
  }
  
  apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
  </code></pre>
  
  <p>And my Android\build.gradle, anything related to google services I added trying to fix this bug but it hasn't helped:</p>
  
  <pre><code>buildscript {
      ext {
          buildToolsVersion = "28.0.3"
          minSdkVersion = 16
          compileSdkVersion = 28
          targetSdkVersion = 28
          googlePlayServicesVersion = "16.+"
          firebaseVersion = "17.3.4"
      }
      repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath("com.android.tools.build:gradle:3.4.2")
          classpath 'com.google.gms:google-services:3.0.0'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          mavenLocal()
          maven {
              // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
              url("$rootDir/../node_modules/react-native/android")
          }
          maven {
              // Android JSC is installed from npm
              url("$rootDir/../node_modules/jsc-android/dist")
          }
  
          google()
          jcenter()
          maven { url 'https://jitpack.io' }
      }
      subprojects {
          project.configurations.all {
              resolutionStrategy.eachDependency { details -&gt;
                  if (details.requested.group == 'com.android.support'
                          &amp;&amp; !details.requested.name.contains('multidex') ) {
                      details.useVersion "26.+"
                  }
                  if (details.requested.group == 'com.google.android.gms'
                  &amp;&amp; !details.requested.name.contains('multidex') &amp;&amp; (
                      !details.requested.name.contains('play-services-stats') ||
                      !details.requested.name.contains('play-services-vision-image-label') ||
                      !details.requested.name.contains('play-services-clearcut') ||
                      !details.requested.name.contains('play-services-flags') ||
                      !details.requested.name.contains('play-services-phenotype')
                      )) {
                      details.useVersion "12.+"
                  }
                  if (details.requested.group == 'com.google.android.gms'
                  &amp;&amp; !details.requested.name.contains('multidex') &amp;&amp; (
                      details.requested.name.contains('play-services-stats') ||
                      details.requested.name.contains('play-services-vision-image-label') ||
                      details.requested.name.contains('play-services-clearcut') ||
                      details.requested.name.contains('play-services-flags') ||
                      details.requested.name.contains('play-services-phenotype')
                      )) {
                      details.useVersion "+"
                  }
                  if (details.requested.group == 'com.google.firebase'
                  &amp;&amp; !details.requested.name.contains('multidex') &amp;&amp; details.requested.name.contains('firebase-messaging')) {
                      details.useVersion "12.+"
                  }
              }
          }
      }
  }
  
  ext {
      googlePlayServicesVersion = "+" // default: "+"
      firebaseVersion = "+" // default: "+"
      // Other settings
      compileSdkVersion = 28 // default: 23
      buildToolsVersion = "28.0.3" // default: "23.0.1"
      targetSdkVersion = 28 // default: 23
      supportLibVersion = "28.0.0"
  }
  </code></pre>
  
  <p><strong>Any help or advice for this would be greatly appreciated.</strong> The end goal is getting my working RN v0.57 app onto the store and I am trying to port my app into a new init'd RN project in order to do that, so if you know an easier way to do that I would gladly go own that path. As far as I can tell there's no quick 'patch' I can apply to 0.57 to make it acceptable to the Play Store, and upgrading directly from 0.57 I believe will be much much more difficult given the problems I've experience with any version changes in RN in the past.</p>