Compile android error in a clean project
See original GitHub issueHi, first of all, thanks for your work on this library! I used in the past and it worked great.
I’m having a compile error on Android in a clean project.
> Task :react-native-udp:generateDebugBuildConfig UP-TO-DATE
> Task :react-native-udp:prepareLintJar UP-TO-DATE
> Task :react-native-udp:generateDebugSources UP-TO-DATE
> Task :react-native-udp:javaPreCompileDebug UP-TO-DATE
> Task :react-native-udp:compileDebugJavaWithJavac UP-TO-DATE
> Task :react-native-udp:processDebugJavaRes NO-SOURCE
> Task :react-native-udp:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
> Task :app:javaPreCompileDebug
> Task :app:compileDebugJavaWithJavac FAILED
/rnproject/android/app/src/main/java/com/rnproject/MainActivity.java:3: error: cannot find symbol
import com.facebook.react.ReactActivity;
^
symbol: class ReactActivity
location: package com.facebook.react
/rnproject/android/app/src/main/java/com/rnproject/MainActivity.java:5: error: cannot find symbol
public class MainActivity extends ReactActivity {
^
symbol: class ReactActivity
/rnproject/android/app/src/main/java/com/rnproject/MainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
I know that it seems that error is related to my MainApplication but this only happening if I activate the react-native-udp module.
react-native-cli: 2.0.1 react-native: 0.58.3
How to reproduce it
- react-native init newproject
- cd newproject
- yarn add react-native-udp
- react-native link react-native-udp
- react-native run-android
MainApplication.java
package com.rnproject;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.tradle.react.UdpSocketsModule;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new UdpSocketsModule()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
distributionUrl = distributionUrl.replace("bin", "all")
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Errors in Android Studio unless I build/clean each time
Try following ways in order of listing: Select Make Project from Build menu. Go to File menu and select Invalidate Cache/restart .
Read more >Different Ways to fix "Execution failed for task ':app:clean ...
Method 1 · Close Android Studio. Then try to manually delete the build files and open Android Studio again. · We need to...
Read more >Command 'clean android project' failed with code: 1 ... - GitHub
Trying to use: npx react-native-clean-project Get the following error:
Read more >Optimize your build speed | Android Developers
Optimize your build configuration by taking a few steps that immediately benefit most Android Studio projects. Profile your build to identify and diagnose...
Read more >Infographic: 11 Most Common Android Errors and How to Fix ...
If you're encountering this error, then try cleaning (Clean > Build Project) and rebuilding your project (Build > Rebuild Project). If this doesn't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tinchoz49 cool, published as 2.4.0
sure, open away
fixed by the release v2.4.0