opentrace-community/opentrace-android

Unresolve reference: BuildConfig

Closed this issue · 12 comments

I'm getting this error with package name : import io.bluetrace.opentrace.BuildConfig. How to solve this?

I'm getting this error with package name : import io.bluetrace.opentrace.BuildConfig. How to solve this?

@Dnyaneshwar1926 : hi, i think to help others to help you, maybe you can give the full build log so we understand which part in the build actually stuck. i believe the main issue is not on the import command as you mentioned.

@Dnyaneshwar1926 did you by any chance change your Application ID (in app/gradle build file) or package name in Manifest file? The code assumes that it is "io.bluetrace.opentrace"

I'm getting this error with package name : import io.bluetrace.opentrace.BuildConfig. How to solve this?

@Dnyaneshwar1926 : hi, i think to help others to help you, maybe you can give the full build log so we understand which part in the build actually stuck. i believe the main issue is not on the import command as you mentioned.

Hey! @alexissinglaire

Sorry for late.

I have clone this project. I think BuildConfig file is missing.
image

@Dnyaneshwar1926 did you by any chance change your Application ID (in app/gradle build file) or package name in Manifest file? The code assumes that it is "io.bluetrace.opentrace"

Hey! @erwanmace

No, I didn't change anything.

@Dnyaneshwar1926 : i believe the issue come from your build process.

try to trigger 'invalidate caches/restart' with following steps:

File -> Invalidate Caches/Restart... -> Invalidate and Restart

@Dnyaneshwar1926 : i believe the issue come from your build process.

try to trigger 'invalidate caches/restart' with following steps:

File -> Invalidate Caches/Restart... -> Invalidate and Restart

@erwanmace I have tried lot of time but no use. I don't see BuildConfig file in project.

@Dnyaneshwar1926 BuildConfig is not a file but refers to buildConfigFields values defined in the app/build.gradle file
As mentioned by @alexissinglaire the problem is likely to come from a build or gradle build issue. The logs/console should tell you more.

@erwanmace & @alexissinglaire Thanks for your valuable time :)

As you guys say its build issue. I have manually cleared cache of android studio & rebuild the project. It worked.

I got this error now. While I run app. I think google-service.json file having an issue right?

image

@Dnyaneshwar1926 : when you register the android app in firebase, you need to put the package name + prefix stg.

let say your package name is: io.bluetrace.opentrace
therefore the registration in firebase will be io.bluetrace.opentrace

after you re-register your android app, dont forget to download the google-services.json and rebuild your android project

@Dnyaneshwar1926 : when you register the android app in firebase, you need to put the package name + prefix stg.

let say your package name is: io.bluetrace.opentrace
therefore the registration in firebase will be io.bluetrace.opentrace

after you re-register your android app, dont forget to download the google-services.json and rebuild your android project

@alexissinglaire
Yes, I gave "io.bluetrace.opentrace" as package Id.

You mean I have give like this "io.bluetrace.opentrace.stg"

@Dnyaneshwar1926 : for debug build somehow the author put applicationIdSuffix "stg" in the build.gradle (check the build.gradle below), therefore when you register your app inside firebase console, you need to add suffix "stg"

buildTypes {
debug {
buildConfigField "String", "FIREBASE_UPLOAD_BUCKET", STAGING_FIREBASE_UPLOAD_BUCKET
buildConfigField "String", "BLE_SSID", STAGING_SERVICE_UUID

        String ssid = STAGING_SERVICE_UUID
        versionNameSuffix "-debug-${getGitHash()}-${ssid.substring(ssid.length() - 5, ssid.length() - 1)}"
        resValue "string", "app_name", "OpenTrace Debug"
        applicationIdSuffix "stg"
    }