Getting error Build failed with an exception
I am developing an app with React Native in which I am trying to create a file in local store and write on the same.
But I am not able to build the project due to below errors
Task :app:compileDebugJavaWithJavac FAILED
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:8: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:16: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
^
symbol: class ReactApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:42: error: cannot find symbol
public ReactNativeHost getReactNativeHost() {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
^
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:41: error: method does not override or implement a method from a supertype
@Override
^
8 errors
My build.gradle file..
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.myfirstproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-fs')
// compile project(':react-native-filesystem')
compile project(':react-native-check-app-install')
// compile project(':react-native-cardview')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompatv7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
react-native
add a comment |
I am developing an app with React Native in which I am trying to create a file in local store and write on the same.
But I am not able to build the project due to below errors
Task :app:compileDebugJavaWithJavac FAILED
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:8: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:16: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
^
symbol: class ReactApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:42: error: cannot find symbol
public ReactNativeHost getReactNativeHost() {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
^
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:41: error: method does not override or implement a method from a supertype
@Override
^
8 errors
My build.gradle file..
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.myfirstproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-fs')
// compile project(':react-native-filesystem')
compile project(':react-native-check-app-install')
// compile project(':react-native-cardview')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompatv7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
react-native
Have you opened the Android project in Android studio? The IDE will give you more of an idea of the error. I remember having to manually edit the Main when importing Facebook
– JRK
Jan 3 at 9:05
add a comment |
I am developing an app with React Native in which I am trying to create a file in local store and write on the same.
But I am not able to build the project due to below errors
Task :app:compileDebugJavaWithJavac FAILED
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:8: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:16: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
^
symbol: class ReactApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:42: error: cannot find symbol
public ReactNativeHost getReactNativeHost() {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
^
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:41: error: method does not override or implement a method from a supertype
@Override
^
8 errors
My build.gradle file..
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.myfirstproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-fs')
// compile project(':react-native-filesystem')
compile project(':react-native-check-app-install')
// compile project(':react-native-cardview')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompatv7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
react-native
I am developing an app with React Native in which I am trying to create a file in local store and write on the same.
But I am not able to build the project due to below errors
Task :app:compileDebugJavaWithJavac FAILED
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:8: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:16: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
^
symbol: class ReactApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:42: error: cannot find symbol
public ReactNativeHost getReactNativeHost() {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
^
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:18: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
F:ReactNativeWorkspaceMyFirstProjectandroidappsrcmainjavacommyfirstprojectMainApplication.java:41: error: method does not override or implement a method from a supertype
@Override
^
8 errors
My build.gradle file..
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.myfirstproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-fs')
// compile project(':react-native-filesystem')
compile project(':react-native-check-app-install')
// compile project(':react-native-cardview')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompatv7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
react-native
react-native
asked Jan 3 at 7:47
pradip_androidpradip_android
10319
10319
Have you opened the Android project in Android studio? The IDE will give you more of an idea of the error. I remember having to manually edit the Main when importing Facebook
– JRK
Jan 3 at 9:05
add a comment |
Have you opened the Android project in Android studio? The IDE will give you more of an idea of the error. I remember having to manually edit the Main when importing Facebook
– JRK
Jan 3 at 9:05
Have you opened the Android project in Android studio? The IDE will give you more of an idea of the error. I remember having to manually edit the Main when importing Facebook
– JRK
Jan 3 at 9:05
Have you opened the Android project in Android studio? The IDE will give you more of an idea of the error. I remember having to manually edit the Main when importing Facebook
– JRK
Jan 3 at 9:05
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018257%2fgetting-error-build-failed-with-an-exception%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018257%2fgetting-error-build-failed-with-an-exception%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you opened the Android project in Android studio? The IDE will give you more of an idea of the error. I remember having to manually edit the Main when importing Facebook
– JRK
Jan 3 at 9:05