Instabug / Instabug-React-Native

In-app feedback and bug reporting tool for React Native
https://instabug.com/platforms/react-native
MIT License
308 stars 100 forks source link

error: local variable version is accessed from within inner class; needs to be declared final .Instabug.setCodePushVersion(version); #1164

Closed sofian-sunny closed 3 months ago

sofian-sunny commented 4 months ago

On the latest version of nstabug-reactnative i m getting below error when building for android. I have tried JDK 11 and 17

error: local variable version is accessed from within inner class; needs to be declared final Instabug.setCodePushVersion(version); ^ "instabug-reactnative": "^12.8.0" "react-native": "^0.68.3"

ahmedAlaaInstabug commented 4 months ago

hello @sofian-sunny 👋 , Thanks for reporting this issue, Can you please provide the build.gradle app file?

sofian-sunny commented 4 months ago

@ahmedAlaaInstabug Below is the build.gradle file

apply plugin: 'com.android.application'

import com.android.build.OutputFile

project.ext.react = [ enableHermes: false, // clean and rebuild if changing nodeExecutableAndArgs : ["/usr/local/bin/node"] ]

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

/**

/**

/**

/**

android { ndkVersion '23.0.7599858' compileSdkVersion 33 lintOptions { checkReleaseBuilds false } configurations { all*.exclude module: 'android-pdf-viewer' } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } dexOptions { incremental true javaMaxHeapSize "6g" preDexLibraries true dexInProcess = true } defaultConfig { applicationId 'com.xyz' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion missingDimensionStrategy 'react-native-camera', 'general' versionCode 122 versionName '3.3.7' multiDexEnabled true } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk true // If true, also generate a universal APK include 'armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64' } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias '' 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' // ndk { // debugSymbolLevel 'SYMBOL_TABLE' // } } }

packagingOptions {
     pickFirst '**/*.so'
}

// 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
        }
    }
}

} configurations.all { resolutionStrategy.force 'com.squareup.okhttp3:okhttp:4.9.0' resolutionStrategy.force 'android.core:core-ktx:1.6.0' } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.facebook.react:react-native:+' // From node_modules implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.annotation:annotation:1.2.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'com.facebook.fresco:animated-gif:2.6.0' implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0' implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.9.0' implementation 'com.google.android.gms:play-services-auth:19.2.0' implementation 'com.google.android.gms:play-services-auth-api-phone:17.5.1' implementation 'com.android.support:multidex:2.0.1' implementation "androidx.core:core-splashscreen:1.0.0" debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' exclude group:'com.squareup.okhttp3', module:'okhttp' }

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
}
implementation 'androidx.multidex:multidex:2.0.1'
if (enableHermes) {
    def hermesPath = '../../node_modules/hermes-engine/android/'
    debugImplementation files(hermesPath + 'hermes-debug.aar')
    releaseImplementation files(hermesPath + 'hermes-release.aar')
} else {
    implementation jscFlavor
}
implementation 'androidx.core:core-ktx:1.6.0'

}

// 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.implementation into 'libs' } task prepareKotlinBuildScriptModel {

}

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 plugin: 'com.google.gms.google-services'

ahmedAlaaInstabug commented 4 months ago

hi @sofian-sunny , thank you for the detailed description, I'll check this out and will get back to you with more info as soon as possible.

stale[bot] commented 4 months ago

This issue has been automatically marked as pending feedback because we need additional information to be able to investigate it further. It will be closed in 7 days if it remains inactive. Thank you for your contributions.

stale[bot] commented 3 months ago

This issue has been automatically closed since we haven't heard back from you. Please feel free to re-open the issue if you have more information to add.