Error building symbol: variable BuildConfig

See original GitHub issue

I addedd ReactNative Facebook SDK. It works great on iOS but on Android it gives me this error when building.

package com.friendster;

import android.app.Application;
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    protected boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage()
      );
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
      return mReactNativeHost;
  }
}

Gives me this error:

:app:compileDebugJavaWithJavac
/development/reactnative/FriendsterProject/Friendster-App/android/app/src/main/java/com/friendster/MainApplication.java:20: error: cannot find symbol
      return BuildConfig.DEBUG;
             ^
  symbol: variable BuildConfig
1 error
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

Thanks in advance

  • React Native version: 0.37.0
  • Platform: Android
  • Operating System: MacOS

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
reza7rmcommented, Feb 11, 2018

@pk-developer @Luckygirlllll you have probably renamed your package name and there’s a file which is addressing your old package name, check your MainApplication.java and MainActivity.java package name and their root folder name to be the same, finally use react-native upgrade command in the root folder of your project and it will probably solve the issue.

1reaction
KGSachinthaUcommented, Apr 2, 2018

@reza7rm Thank dude …!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Android Build Error MainActivity.java:29
Show activity on this post. I'm getting this error when trying to compile my React Native android app. The Android app can't resolve...
Read more >
Android Studio BuildConfig file missing FIX - YouTube
In this video we will fix BuildConfig file missing issue or Java Generated folder missing.If it worked for you don't forget to subscribe!...
Read more >
Gradle buildConfigField BuildConfig cannot resolve symbol
Android : Gradle buildConfigField BuildConfig cannot resolve symbol [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >
error: cannot find symbol variable BuildConfig - Doc
I am using Gradle to build my Android application. I am trying to use some flags based on the build type (release or...
Read more >
cannot find symbol return BuildConfig.DEBUG; Code Example
cannot find symbol BuildConfig.DEBUG symbol: variable BuildConfig ; Could not find a production build in the · Set the 'program' value in your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found