I'm getting this error after running npx react-native run-android, and I'm new to react and node in general so I'm not sure what could be going on.
gradle build --warning-mode all runs successfully with no issue. Not sure what could be going on. Running react-native upgrade doesn't help as suggested in similar questions, but it does give the error "Accessing non-existent property 'padLevels' of module exports inside circular dependency", though I think it's unrelated.
I'm on npm 6.14.10, node v14.15.4, Gradle 6.4, react-native-cli 2.0.1, react-native 0.63.4, openjdk 14.0.2
> Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings
106 actionable tasks: 2 executed, 104 up-to-date
/android/app/src/main/java/com/test/MainApplication.java:20: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
/android/app/src/main/java/com/test/MainApplication.java:59: error: cannot find symbol
if (BuildConfig.DEBUG) {
^
symbol: variable BuildConfig
location: class MainApplication
/android/app/src/main/java/com/test/MainApplication.java:59: error: illegal parenthesized expression
if (BuildConfig.DEBUG) {
^
Note: /android/app/src/debug/java/com/test/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Since the last update of Android Studio (today is 23th of August 2020), each time I create a new flutter project I can't run it. Even if I do not modify a line of code and only create a blank new project then run it.
All my previous flutter project can be run in my VD without any problem. But I can't work on new projects because of this build failure.
I emptied cache using the menu 'File/Invalidate Caches / Restart ...'
I upgraded Flutter using "flutter upgrade --force' then 'flutter run -v' like in this post but it did not work for me.
I learn flutter via courses online but I don't know what to do to solve this problem.
Do you have a solution ?
Thank you
Here is what happens in the console (with a new flutter application project):
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-hi\values-hi.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-de\values-de.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lo\values-lo.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-pt\values-pt.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lt\values-lt.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-hr\values-hr.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Steeve\Documents\Flutter\androidstudio\proj\boule_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lv\values-lv.xml: AAPT: error: file failed to compile.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 24s
Exception: Gradle task assembleDebug failed with exit code 1
Delete the androidstudio folder from the C:\Users\Steeve\Documents\Flutter\ directory.
I am working with Ionic project and I need to run this project with my android studio. I have resolved all the issues which are coming in the gradle file but when I am trying to run the code getting below error
error - No resource identifier found for attribute 'appComponentFactory' in package 'android'
enter image description here
above image is when I have fixed all the issue
but getting below error on runtime
**AGPBI: {"kind":"error","text":"No resource identifier found for attribute \u0027appComponentFactory\u0027 in package \u0027android\u0027","sources":[{"file":"/Users/naya-pc/Documents/Ionic/xyz/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml","position":{"startLine":57}}],"original":"","tool":"AAPT"}
/Users/naya-pc/Documents/Ionic/xyz/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml:58: error: No resource identifier found for attribute 'appComponentFactory' in package 'android'
:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt**
Also, I have tried the basic technique to resolve this type of issue
1. clean project
2. rebuild project
3. invalidate the cache and restart
but still getting the same issue.
I have changed almost every gradle file with the new one and old one but getting the same issue below are my gradle and they are working gradle.
compile "com.android.support:support-v4:22.0.0"
compile "com.android.support:appcompat-v7:22.0.0"
compile "com.facebook.android:facebook-android-sdk:4.+"
compile "com.google.gms:google-services:+"
compile "com.google.android.gms:play-services-tagmanager:+"
compile "com.google.firebase:firebase-core:+"
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-crash:+"
compile "com.google.firebase:firebase-config:+"
compile "com.google.android.gms:play-services-base:15.0.1"
compile "com.google.android.gms:play-services-ads:15.0.1"
compile "com.google.android.gms:play-services-auth:15.0.1"
compile "com.google.android.gms:play-services-identity:15.0.1"
Please help me if you have any solution for this issue.
Using android-studio 1.5 and getting error when run in device
Error:(26, 36) error: package com.google.android.gms.authn does not exist
Added in gradle setting
dependencies {
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-location:+'
}. Help to fix
I'm facing an error when compiling my Java sources to produce C++ headers recently: javah spits a package does not exist error for some file.
tl;dr: javah works fine for a Java source but not another one – which import clauses are pretty close; gradle does not process some libraries but even the packages of the processed ones get flagged as missing.
I don't know why javah has started spitting that error since it worked well until recently and I did not change anything special. I'm using gradle with Android Studio's gradle-wrapper. I recently updated the wrapper's distribution from 2.2.1 to 2.10 but I don't think that's why javah fails now.
According to the logs and the present files, javah doesn't find the packages from libraries I'm using as it compiles ClassB but not ClassA.
Let's take two examples: com.batch.android and com.adjust.sdk
com.batch.android library does get processed by gradle so its jars are in my build/intermediates/exploded-aar folder (under com.batch.android/batch-sdk/1.5.3/jars/classes.jar and com.batch.android/batch-sdk/1.5.3/jars/libs/batch.jar)
com.adjust.sdk library does not get processed by gradle so its jars are not in my build/intermediates/exploded-aar
both are in my ~/.gradle/cache/ folder
both packages fail as missing by javah
both packages are not imported from ClassA and ClassB java files
Thanks for your help!
The gradle logs (sorry guys, it's super long):
Executing tasks: [:app:clean, :app:generateDevAmazonDebugSources, :app:generateDevAmazonDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDevAmazonDebugUnitTestDependencies, :app:assembleDevAmazonDebug]
Configuration on demand is an incubating feature.
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy UP-TO-DATE
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes UP-TO-DATE
:buildSrc:jar UP-TO-DATE
:buildSrc:assemble UP-TO-DATE
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy UP-TO-DATE
:buildSrc:processTestResources UP-TO-DATE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test UP-TO-DATE
:buildSrc:check UP-TO-DATE
:buildSrc:build UP-TO-DATE
Generating assets binaries
Incremental java compilation is an incubating feature.
Cleaning project...
:app:clean
:app:processAssets
:app:copyFiles
:app:preBuild
:app:preDevAmazonDebugBuild
:app:checkDevAmazonDebugManifest
:app:preDevAmazonReleaseBuild
:app:preDevGoogleDebugBuild
:app:preDevGoogleReleaseBuild
:app:preProdAmazonDebugBuild
:app:preProdAmazonReleaseBuild
:app:preProdGoogleDebugBuild
:app:preProdGoogleReleaseBuild
:app:prepareComAndroidSupportAppcompatV72311Library
:app:prepareComAndroidSupportCardviewV72320Library
:app:prepareComAndroidSupportMediarouterV72220Library
:app:prepareComAndroidSupportMultidex100Library
:app:prepareComAndroidSupportRecyclerviewV72311Library
:app:prepareComAndroidSupportSupportV42320Library
:app:prepareComBatchAndroidBatchSdk153Library
:app:prepareComCrashlyticsSdkAndroidAnswers136Library
:app:prepareComCrashlyticsSdkAndroidBeta114Library
:app:prepareComCrashlyticsSdkAndroidCrashlytics255Library
:app:prepareComCrashlyticsSdkAndroidCrashlyticsCore238Library
:app:prepareComCrashlyticsSdkAndroidCrashlyticsNdk112Library
:app:prepareComFacebookAndroidFacebookAndroidSdk4101Library
:app:prepareComGoogleAndroidExoplayerExoplayerR142Library
:app:prepareComGoogleAndroidGmsPlayServices780Library
:app:prepareComGoogleAndroidGmsPlayServicesAds780Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics780Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing780Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite780Library
:app:prepareComGoogleAndroidGmsPlayServicesAppstate780Library
:app:prepareComGoogleAndroidGmsPlayServicesBase780Library
:app:prepareComGoogleAndroidGmsPlayServicesCast780Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive780Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness780Library
:app:prepareComGoogleAndroidGmsPlayServicesGames780Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm780Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity780Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation780Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps780Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby780Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama780Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus780Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet780Library
:app:prepareComGoogleAndroidGmsPlayServicesVision780Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet780Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable780Library
:app:prepareComMopubMopubSdk440Library
:app:prepareComZendeskBelvedere1011Library
:app:prepareComZendeskSdk1512Library
:app:prepareComZendeskSdkProviders1512Library
:app:prepareIoBranchSdkAndroidLibrary1112Library
:app:prepareIoFabricSdkAndroidFabric1310Library
:app:prepareDevAmazonDebugDependencies
:app:compileDevAmazonDebugAidl
:app:compileDevAmazonDebugRenderscript
:app:generateDevAmazonDebugBuildConfig
:app:generateDevAmazonDebugAssets UP-TO-DATE
:app:mergeDevAmazonDebugAssets
:app:processDevAmazonDebugManifest
:app:fabricGenerateResourcesDevAmazonDebug
:app:generateDevAmazonDebugResValues UP-TO-DATE
:app:processDevAmazonDebugGoogleServices
:app:generateDevAmazonDebugResources
:app:mergeDevAmazonDebugResources
:app:processDevAmazonDebugResources
:app:generateDevAmazonDebugSources
:app:preDevAmazonDebugAndroidTestBuild
:app:prepareDevAmazonDebugAndroidTestDependencies
:app:compileDevAmazonDebugAndroidTestAidl
:app:processDevAmazonDebugAndroidTestManifest
:app:compileDevAmazonDebugAndroidTestRenderscript
:app:generateDevAmazonDebugAndroidTestBuildConfig
:app:generateDevAmazonDebugAndroidTestAssets UP-TO-DATE
:app:mergeDevAmazonDebugAndroidTestAssets
:app:generateDevAmazonDebugAndroidTestResValues UP-TO-DATE
:app:generateDevAmazonDebugAndroidTestResources
:app:mergeDevAmazonDebugAndroidTestResources
:app:processDevAmazonDebugAndroidTestResources
:app:generateDevAmazonDebugAndroidTestSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDevAmazonDebugUnitTestBuild
:app:prepareDevAmazonDebugUnitTestDependencies
:app:javahBuild_ClassA
:app:javahBuild_ClassB
Error: package com.adjust.sdk does not exist
Error: package com.adjust.sdk does not exist
Error: package com.amazon.ags.api does not exist
Error: package com.batch.android does not exist
Error: package com.batch.android does not exist
Error: package com.crashlytics.android does not exist
Error: package com.crashlytics.android.answers does not exist
Error: package com.crashlytics.android.answers does not exist
Error: package com.crashlytics.android.answers does not exist
Error: package com.mopub.common does not exist
Error: package com.zendesk.sdk.feedback.impl does not exist
Error: package com.zendesk.sdk.model.access does not exist
Error: package com.zendesk.sdk.model.access does not exist
Error: package com.zendesk.sdk.model.push does not exist
Error: package com.zendesk.sdk.network.impl does not exist
Error: package com.zendesk.sdk.network.impl does not exist
Error: package com.zendesk.sdk.network.impl does not exist
Error: package com.zendesk.sdk.network.impl does not exist
Error: package com.zendesk.sdk.network.impl does not exist
Error: package com.zendesk.sdk.requests does not exist
Error: package com.zendesk.sdk.storage does not exist
Error: package com.zendesk.sdk.support does not exist
Error: package com.zendesk.service does not exist
Error: package com.zendesk.service does not exist
Error: package org.joda.time does not exist
Error: package org.joda.time does not exist
Error: package org.joda.time does not exist
Error: package org.joda.time does not exist
Error: package org.joda.time.format does not exist
Error: package org.joda.time.format does not exist
Error: package io.branch.indexing does not exist
Error: package io.branch.referral does not exist
Error: package io.branch.referral does not exist
Error: package io.branch.referral does not exist
Error: package io.branch.referral.util does not exist
Error: package io.branch.referral.util does not exist
Error: package com.adjust.sdk does not exist
Error: package com.amazon.ags.api does not exist
Error: package com.amazon.ags.api does not exist
Error: package com.amazon.ags.api does not exist
Error: package com.amazon.ags.api does not exist
Error: package com.applovin.sdk does not exist
Error: package com.batch.android does not exist
Error: package com.crashlytics.android does not exist
Error: package com.crashlytics.android.ndk does not exist
Error: package io.branch.referral does not exist
Error: package io.branch.referral does not exist
Error: package io.fabric.sdk.android does not exist
Error: package com.google.android.gms.analytics does not exist
Error: package com.google.android.gms.analytics does not exist
Error: package com.google.android.gms.analytics does not exist
Error: package com.google.android.gms.ads.identifier does not exist
Error: package com.google.android.gms.common does not exist
Error: package com.mopub.common does not exist
Error: package com.mopub.common does not exist
Error: cannot find symbol
symbol: class MoPubErrorCode
location: package com.mopub.mobileads
Error: cannot find symbol
symbol: class MoPubRewardedVideoListener
location: package com.mopub.mobileads
Error: package com.chartboost.sdk does not exist
Error: package com.adjust.sdk does not exist
Error: package com.adjust.sdk does not exist
Error: package com.adjust.sdk does not exist
Error: package com.adjust.sdk does not exist
Error: cannot find symbol
symbol: class BaseZendeskFeedbackConfiguration
location: class my.super.project.Renderer
Error: cannot find symbol
symbol: class BuildConfig
location: package my.super.project
Error: cannot find symbol
symbol: class Tracker
location: class my.super.project.Main
Error: ';' expected
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook does not exist
Error: package com.facebook.appevents does not exist
Error: package com.facebook.login does not exist
Error: package com.facebook.login does not exist
Error: package com.facebook.share.model does not exist
Error: package com.facebook.share.model does not exist
Error: package com.facebook.share.model does not exist
Error: package com.facebook.share.widget does not exist
Error: package com.facebook.share.widget does not exist
Error: package com.facebook.share.widget does not exist
Error: package twitter4j does not exist
Error: package twitter4j does not exist
Error: package twitter4j does not exist
Error: package twitter4j does not exist
Error: package twitter4j does not exist
Error: package twitter4j does not exist
Error: package twitter4j does not exist
Error: package twitter4j does not exist
Error: package twitter4j.auth does not exist
Error: cannot find symbol
symbol: class R
location: package my.super.project
Error: cannot find symbol
symbol: class AmazonGamesClient
location: class my.super.project.Main
Error: cannot find symbol
symbol: class MoPubRewardedVideoListener
location: class my.super.project.Main
Error: cannot find symbol
symbol: class ChartBoostDelegate
location: class my.super.project.Main
Error: cannot find symbol
symbol: class CallbackManager
location: class my.super.project.ClassA
Error: cannot find symbol
symbol: class ProfileTracker
location: class my.super.project.ClassA
FAILED
FAILURE: Build failed with an exception.
My build.gradle has the following tasks:
android {
<snip>
['Main', 'Renderer', 'ClassA', 'ClassB'].each {
def targetName ->
tasks.create(name: "javahBuild_$targetName", type: Exec) {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
String sdkDir = properties.getProperty('sdk.dir')
String flavorFolder = getCurrentFlavorFolder()
commandLine 'javah', '-classpath', "libs/:src/main/java/:$sdkDir/platforms/android-23/android.jar:build/intermediates/classes/$flavorFolder/$config:$sdkDir/platforms/android-23/optional/org.apache.http.legacy.jar/:$config/", '-d', 'src/main/jni/Main/', "my.super.project.${targetName}"
}
}
task javahBuildAll(dependsOn: tasks.matching { Task task -> task.name.startsWith("javahBuild_") })
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn javahBuildAll
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.2#aar') {
transitive = true
}
compile('com.mopub:mopub-sdk:4.4.0#aar') {
transitive = true
}
compile group: 'com.zendesk', name: 'sdk', version: '1.5.1.2'
compile('com.android.support:multidex:1.0.0')
compile('com.google.android.gms:play-services:7.8.0')
compile('com.google.android.gms:play-services-analytics:7.8.0')
compile('com.google.android.gms:play-services-gcm:7.8.0')
compile('com.android.support:appcompat-v7:23.1.0')
compile('com.android.support:support-v4:23.1.0')
compile('com.facebook.android:facebook-android-sdk:4.10.+')
compile('io.branch.sdk.android:library:1.+')
compile('com.batch.android:batch-sdk:1.5+')
compile('com.adjust.sdk:adjust-android:4.2.3')
compile('joda-time:joda-time:2.9.2')
}
OK it didn't understand why I'm getting those errors but I just realized I could ignore them since the C++ header files are still getting generated.
So I decide to modify my javah gradle task to ignore errors and write those into a dedicated log file. I've added the following line:
errorOutput = project.file("build/javah_error_${targetName}.log").newDataOutputStream()
ignoreExitValue = true
My javah task now looks like this:
['Main', 'Renderer', 'ClassA', 'ClassB'].each {
def targetName ->
tasks.create(name: "javahBuild_$targetName", type: Exec) {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
String sdkDir = properties.getProperty('sdk.dir')
String flavorFolder = getCurrentFlavorFolder()
errorOutput = project.file("build/javah_error_${targetName}.log").newDataOutputStream()
ignoreExitValue = true
commandLine 'javah', '-classpath', "libs/:src/main/java/:$sdkDir/platforms/android-23/android.jar:build/intermediates/classes/$flavorFolder/$config:$sdkDir/platforms/android-23/optional/org.apache.http.legacy.jar/:$config/", '-d', 'src/main/jni/Main/', "my.super.project.${targetName}"
}
}
After multiple hours of searching, researching, trial and error, and other things, I’ve finally got it.
javah is gone, one must use javac […] -h <destdir> […] now.
I already had the following snippet in my top-level build.gradle (not the one under app/ or so!) to add javac arguments…
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
… and “just” had to extend that. (This section goes into the allprojects { block which you already have in your top-level build.gradle, I put it after the repositories { […] } block.)
In my case, I merely wanted to let the .h files be created but not actively #include them in the C code (because I use the RegisterNatives method to register my functions), which would be… tricky, as one would additionally to this have to:
figure out which of the (possibly multiple) tasks should create the .h files used in the actual build
give that a stable pathname
add that path to the include directories in the native build (again tricky)
For mere manual introspection, I just add the javac -h <destdir> option to all javac invocations, creating per-task result directories, and then just look at them in Midnight Commander:
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
options.getHeaderOutputDirectory().value(project.layout.buildDirectory.dir("headers/" + getName()))
}
(The compilerArgs change is, of course, copied unchanged from the above.)