You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My react native run android fails with following error:
C:\Users\abhay\React\infp_devices\android\app\src\main\java\com\infp_devices\MainActivity.java:19:
error: cannot find symbol
protected List getPackages() {
^ symbol: class List location: class MainActivity C:\Users\abhay\React\infp_devices\android\app\src\main\java\com\infp_devices\MainActivity.java:19:
error: cannot find symbol
protected List getPackages() {
^ symbol: class ReactPackage location: class MainActivity
C:\Users\abhay\React\infp_devices\android\app\src\main\java\com\infp_devices\MainActivity.java:18:
error: method does not override or implement a method from a supertype @OverRide
^ C:\Users\abhay\React\infp_devices\android\app\src\main\java\com\infp_devices\MainActivity.java:21:
error: cannot find symbol
new MainReactPackage(),
^ symbol: class MainReactPackage location: class MainActivity
C:\Users\abhay\React\infp_devices\android\app\src\main\java\com\infp_devices\MainActivity.java:20:
error: cannot find symbol
return Arrays.asList(
^ symbol: class ReactPackage location: class MainActivity
C:\Users\abhay\React\infp_devices\android\app\src\main\java\com\infp_devices\MainActivity.java:20:
error: cannot find symbol
return Arrays.asList(
^ symbol: variable Arrays location: class MainActivity 6 errors :app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I have made following changes :
In android/setting.gradle :
include ':react-native-chart-android'
project(':react-native-chart-android').projectDir = new
File(rootProject.projectDir, '../node_modules/react-native-chart-
android/android')
In android/app/build.gradle:
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_module
compile project(':react-native-chart-android') //Changes to the code
}
My entire android/app/src/main/java/com/xxxxxxx/MainActivity.java, (XXXXXXX is my app name), looks as follows :
package com.xxxxxxx; // xxxxxxx is my app name
import com.facebook.react.ReactActivity;
import cn.mandata.react_native_mpchart.MPChartPackage; // <--- import
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "xxxxxxx"; //xxxxxxx is my app name
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MPChartPackage());
}
}
My application code looks as follows :
import React from 'react';
import { View, Text } from 'react-native';
import {
BarChart,
CombinedChart
} from 'react-native-chart-android';
import { getBarData } from './graphComponent';
const graphDisplay = (props) => {
// const myData = getBarData();
return (
<View style={{flex:1}}>
<BarChart style={{flex:1}} data={getBarData()} />
/View>
);
});
export default graphDisplay;
I get a fatal ESLint error on the BarChart tag line as "Unterminated JSX content (Fatal)". However I have not got around to solving it. Not sure if it is relevant for this problem.
Please help
Edited:
My code for the imported getBarData() function is as follows:
My react native run android fails with following error:
I have made following changes :
In android/setting.gradle :
In android/app/build.gradle:
My entire android/app/src/main/java/com/xxxxxxx/MainActivity.java, (XXXXXXX is my app name), looks as follows :
My application code looks as follows :
I get a fatal ESLint error on the BarChart tag line as "Unterminated JSX content (Fatal)". However I have not got around to solving it. Not sure if it is relevant for this problem.
Please help
Edited:
My code for the imported getBarData() function is as follows:
The text was updated successfully, but these errors were encountered: