invertase / react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
https://docs.page/invertase/react-native-google-mobile-ads
Other
702 stars 142 forks source link

[🐛] Android Build Error - java.lang.NoClassDefFoundError: org/jetbrains/kotlin/gradle/plugin/KotlinBasePlugin #441

Closed ishuuwag closed 1 year ago

ishuuwag commented 1 year ago

What happened?

Running gradlew clean results in java.lang.NoClassDefFoundError: org/jetbrains/kotlin/gradle/plugin/KotlinBasePlugin

Screenshot 2023-08-24 at 01 34 09

Platforms

Only on Android

React Native Info

System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 86.45 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.4 - /usr/local/bin/npm
    Watchman: 2023.08.14.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 27, 28, 29, 30, 31, 32
      Build Tools: 28.0.3, 29.0.0, 29.0.1, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.1.0
      System Images: android-29 | Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7784292
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
    Python: Not Found
  npmPackages:
    @react-native-community/cli: ^4.7.0 => 4.14.0 
    react: 16.11.0 => 16.11.0 
    react-native: ^0.62.2 => 0.62.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Are your using Typescript?

package.json

{
  "name": "intercity",
  "version": "2.1.0",
  "private": true,
  "scripts": {
    "build": "tsc",
    "android": "react-native run-android",
    "android-dev": "cd android && ./gradlew clean && cd .. && adb reverse tcp:8081 tcp:8081 && react-native run-android",
    "android-test-prod": "adb reverse tcp:8081 tcp:8081 && npx react-native run-android --variant=release",
    "android-bundle-staging": "npx jetify && cd android && ./gradlew clean bundleStaging",
    "android-bundle-release": "npx jetify && cd android && ./gradlew clean bundleRelease --scan",
    "android-release-staging": "npx jetify && cd android && fastlane beta",
    "android-release-prod": "npx jetify && cd android && fastlane release",
    "android-dist-staging": "npx jetify && cd android && fastlane fbbeta",
    "android-dist-prod": "npx jetify && cd android && fastlane fbrelease",
    "android-build": "npx jetify && cd android && fastlane build",
    "ios": "react-native run-ios",
    "ios-test-prod": "npx react-native run-ios --configuration Release --device",
    "ios-dev": "react-native run-ios --configuration Debug --device",
    "ios-beta": "./fastlane-deploy-beta.sh",
    "ios-release": "./fastlane-release.sh",
    "ios-release-adhoc": "./fastlane-release-adhoc.sh",
    "ios-testflight-release": "./fastlane-testflight-release.sh prod",
    "ios-testflight-beta": "./fastlane-testflight-release.sh staging",
    "endgame": "watchman watch-del-all && yarn start -- --reset-cache",
    "updateiosversion": "cd ios && ./update-ios-version.sh",
    "version": "cd ios && ./update-ios-version.sh && git add -A",
    "postversion": "git push && git push --tags",
    "start": "react-native start",
    "link:gen-client": "yarn link servercity-swagger && yarn build:client",
    "build:client": "openapi-generator generate -i ./node_modules/servercity-swagger/build/latest.json -g typescript-axios -o src/api",
    "test": "jest",
    "test:watch": "jest --watch"
  },
  "dependencies": {
    "@expo/vector-icons": "^6.3.1",
    "@invertase/react-native-apple-authentication": "^1.1.2",
    "@notifee/react-native": "^5.5.0",
    "@react-native-community/async-storage": "^1.6.2",
    "@react-native-community/cli": "^4.7.0",
    "@react-native-community/datetimepicker": "3.0.9",
    "@react-native-community/google-signin": "^3.0.3",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-firebase/app": "11.5.0",
    "@react-native-firebase/auth": "11.5.0",
    "@react-native-firebase/messaging": "11.5.0",
    "@react-native-firebase/remote-config": "11.5.0",
    "@react-native-firebase/storage": "11.5.0",
    "@react-native-picker/picker": "react-native-picker/picker",
    "@react-navigation/bottom-tabs": "^5.11.7",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",
    "@types/luxon": "^1.24.0",
    "@types/react-native-fbsdk": "^1.1.0",
    "adm-zip": "^0.4.11",
    "axios": "^0.21.1",
    "camelcase-keys": "^6.2.2",
    "emoji-flags": "^1.2.0",
    "fast-xml-parser": "^3.21.0",
    "luxon": "^1.21.1",
    "native-base": "^2.13.12",
    "plist": "^3.0.1",
    "portable-fetch": "^3.0.0",
    "react": "16.11.0",
    "react-native": "^0.62.2",
    "react-native-card-flip": "^1.0.4",
    "react-native-config": "^0.12.0",
    "react-native-device-info": "^8.1.3",
    "react-native-fbsdk-next": "^7.3.3",
    "react-native-gesture-handler": "^1.5.0",
    "react-native-google-mobile-ads": "^12.0.0",
    "react-native-hr-component": "^2.0.3",
    "react-native-image-crop-picker": "^0.26.1",
    "react-native-indicators": "^0.17.0",
    "react-native-ionicons": "^4.6.3",
    "react-native-network-activity-indicator": "^1.0.2",
    "react-native-permissions": "^3.6.0",
    "react-native-reanimated": "^1.4.0",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.0.0-alpha.7",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-vector-icons": "^9.1.0",
    "react-native-webview": "^11.14.2",
    "react-navigation": "^4.4.3",
    "react-navigation-stack": "^2.10.2",
    "react-navigation-tabs": "^2.5.6",
    "rxjs": "^6.5.5",
    "servercity-swagger": "git+ssh://git@github.com:intercity-namibia/servercity-swagger.git",
    "snakecase-keys": "^3.2.1",
    "url": "^0.11.0",
    "xcode": "^1.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.22.10",
    "@babel/plugin-transform-modules-commonjs": "^7.22.5",
    "@babel/plugin-transform-typescript": "^7.22.10",
    "@babel/runtime": "^7.22.10",
    "@react-native-community/eslint-config": "^0.0.5",
    "@types/emoji-flags": "^1.2.0",
    "@types/jest": "^25.2.3",
    "@types/react": "^16.8.1",
    "@types/react-native": "^0.61.3",
    "@types/react-native-indicators": "^0.16.0",
    "@types/react-test-renderer": "^16.8.1",
    "@typescript-eslint/eslint-plugin": "^3.0.0",
    "@typescript-eslint/parser": "^3.0.0",
    "babel-eslint": "^10.0.3",
    "babel-jest": "^26.0.1",
    "babel-plugin-module-resolver": "^3.2.0",
    "babel-preset-react-native-syntax": "^1.0.0",
    "eslint": "^6.6.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-import-resolver-babel-module": "^5.1.0",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-react": "^7.20.0",
    "jest": "^26.0.1",
    "jetifier": "^1.6.5",
    "metro-react-native-babel-preset": "^0.59.0",
    "patch-package": "^6.4.7",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "^2.0.5",
    "react-test-renderer": "16.8.1",
    "ts-jest": "^26.1.0",
    "typescript": "^4.4.4"
  }
}

app.json

{
  "name": "intercity",
  "displayName": "InterCity",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-5985865993495960~2263836454",
    "ios_app_id": "ca-app-pub-5985865993495960~9623737138",
    "sk_ad_network_items": [
      "cstr6suwn9.skadnetwork",
      "4fzdc2evr5.skadnetwork",
      "4pfyvq9l8r.skadnetwork",
      "2fnua5tdw4.skadnetwork",
      "ydx93a7ass.skadnetwork",
      "5a6flpkh64.skadnetwork",
      "p78axxw29g.skadnetwork",
      "v72qych5uu.skadnetwork",
      "ludvb6z3bs.skadnetwork",
      "cp8zw746q7.skadnetwork",
      "c6k4g5qg8m.skadnetwork",
      "s39g8k73mm.skadnetwork",
      "3qy4746246.skadnetwork",
      "3sh42y64q3.skadnetwork",
      "f38h382jlk.skadnetwork",
      "hs6bdukanm.skadnetwork",
      "prcb7njmu6.skadnetwork",
      "v4nxqhlyqp.skadnetwork",
      "wzmmz9fp6w.skadnetwork",
      "yclnxrl5pm.skadnetwork",
      "t38b2kh725.skadnetwork",
      "7ug5zh24hu.skadnetwork",
      "9rd848q2bz.skadnetwork",
      "y5ghdn5j9k.skadnetwork",
      "n6fk4nfna4.skadnetwork",
      "v9wttpbfk9.skadnetwork",
      "n38lu8286q.skadnetwork",
      "47vhws6wlr.skadnetwork",
      "kbd757ywx3.skadnetwork",
      "9t245vhmpl.skadnetwork",
      "a2p9lx4jpn.skadnetwork",
      "22mmun2rn5.skadnetwork",
      "4468km3ulz.skadnetwork",
      "2u9pt9hc89.skadnetwork",
      "8s468mfl3y.skadnetwork",
      "av6w8kgt66.skadnetwork",
      "klf5c3l5u5.skadnetwork",
      "ppxm28t8ap.skadnetwork",
      "424m5254lk.skadnetwork",
      "ecpz2srf59.skadnetwork",
      "uw77j35x4d.skadnetwork",
      "mlmmfzh3r3.skadnetwork",
      "578prtvx9j.skadnetwork",
      "4dzt52r2t5.skadnetwork",
      "gta9lk7p23.skadnetwork",
      "e5fvkxwrpn.skadnetwork",
      "8c4e2ghe7u.skadnetwork",
      "zq492l623r.skadnetwork",
      "3rd42ekr43.skadnetwork",
      "3qcr597p9d.skadnetwork"
    ]
  }
}

ios/Podfile

platform :ios, '13.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
use_modular_headers!
ENV['SWIFT_VERSION'] = '5.0'

target 'intercity' do
  # Pods for intercity
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  # Add new pods below this line
  pod 'Permission-AppTrackingTransparency', :path => '../node_modules/react-native-permissions/ios/AppTrackingTransparency'

  # Don not remove this, this enables dark mode support
  pod 'QBImagePickerController', :path => '../node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePickerController.podspec'

  use_native_modules!
  post_install do |installer|
    find_and_replace("../node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m",
    "_currentFrame.CGImage;","_currentFrame.CGImage ;} else { [super displayLayer:layer];")
    find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
        "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
    find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
         "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
    find_and_replace("../node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp", "node->getLayout().hadOverflow() |", "node->getLayout().hadOverflow() ||")
    installer.generated_projects.each do |project|
      project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
        end
      end
    end
  end
end

target 'intercityTests' do
    inherit! :search_paths
    # Pods for testing
end

def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {

    ext {
        kotlinVersion = "1.8.22"
        buildToolsVersion = "31.0.0"
        minSdkVersion = 20
        compileSdkVersion = 31
        targetSdkVersion = 31
        supportLibVersion = "27.1.1"
        googlePlayServicesAuthVersion = "16.0.1" // <--- use this version or newer
    }

    repositories {
        mavenLocal()
        mavenCentral()
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.4.3"
        classpath "com.google.gms:google-services:4.3.3"
        //classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

//apply plugin: "kotlin-android"

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

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")
        }
        mavenCentral()
        google()
        jcenter()
        maven { url 'https://jitpack.io' }

    }
    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.66, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
            force "com.android.support:support-v4:28.0.0"

        }
    }
}

android/app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]

project.ext.envConfigFiles = [
    debug: ".env",
    release: ".env.production",
    staging: ".env.staging",
]

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

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    def packageJson = new groovy.json.JsonSlurper().parseText(file('../../package.json').text)

    defaultConfig {
        generatedDensities = []
        multiDexEnabled true
        applicationId "na.com.intercity"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 123
        versionName packageJson.version
        vectorDrawables.useSupportLibrary = true
        resValue "string", "build_config_package", "na.com.intercity"
    }
    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'
        }
        release {
            storeFile file('keystore.jks')
            storePassword ''
            keyAlias 'upload'
            keyPassword ''
        }
        staging {
            storeFile file('keystore.jks')
            storePassword ''
            keyAlias 'upload'
            keyPassword ''
        }
    }
    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.release
            minifyEnabled enableProguardInReleaseBuilds
            matchingFallbacks = ['release', 'debug']
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
        staging {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            matchingFallbacks = ['release', 'debug']
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // 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
            }

        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    // compileOptions {
    //     sourceCompatibility JavaVersion.VERSION_1_8
    //     targetCompatibility JavaVersion.VERSION_1_8
    // }
}

dependencies {

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'com.google.android.gms:play-services-ads:22.2.0'
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.facebook.android:facebook-android-sdk:latest.release'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22"

    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)
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply plugin: 'com.google.gms.google-services'

android/settings.gradle

rootProject.name = 'intercity'
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':app'
//includeBuild('../node_modules/@react-native/gradle-plugin')

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" package="na.com.intercity">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <application android:name=".MainApplication" android:label="@string/app_name" android:enabled="true" android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme" android:largeHeap="true">
        <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustResize" android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
        <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="@string/admob_app_id" />
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />
        <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_launcher" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:value="@color/colorPrimary" />
        <activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" />
        <activity android:name="com.facebook.CustomTabActivity" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
    </application>
</manifest>
DoctorJohn commented 1 year ago

Could you check whether you can compile this repositories example project? This could reveal whether it's a build environment related issue.

lordival commented 1 year ago

Me too getting a kotlin-related error here when building.

"A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction"

github-actions[bot] commented 1 year ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.