Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Android Build Error MainActivity.java:29: error: cannot find symbol

Tags:

react-native

I'm getting this error when trying to compile my React Native android app. The Android app can't resolve BuildConfig.DEBUG.

:app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac /Users/amirsharif/mobile-rappad/android/app/src/main/java/com/rappadmobile/MainActivity.java:29: error: cannot find symbol                 .setUseDeveloperSupport(BuildConfig.DEBUG)                                         ^   symbol:   variable BuildConfig   location: class MainActivity >1 error :app:compileDebugJavaWithJavac FAILED 

I can temporarily resolve it by simply setting it to true. This might've happened after I changed an application name (since that's something I've also been trying to do).

I probably have to change something with Gradle so it generates the right kind of files again.

/**  * Automatically generated file. DO NOT MODIFY  */ package com.app;  public final class BuildConfig {   public static final boolean DEBUG = Boolean.parseBoolean("true");   public static final String APPLICATION_ID = "com.rappadmobile";   public static final String BUILD_TYPE = "debug";   public static final String FLAVOR = "";   public static final int VERSION_CODE = 1;   public static final String VERSION_NAME = "1.0"; } 
like image 702
Overload119 Avatar asked Jan 25 '16 14:01

Overload119


1 Answers

I had the same issue and it was resolved by simply adding following import statement in MainApplication.java:

import com.facebook.react.BuildConfig; 
like image 66
Manoj Goel Avatar answered Oct 14 '22 16:10

Manoj Goel