I am working on a react-native
project and it is working fine on development mode (running via react-native run-android
) but when I tried to generate unsigned APK using this link I got some errors
which I showed below.
I followed the first comment and it is to run this command on root of my project.
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle
--assets-dest ./android/app/build/intermediates/res/merged/debu
and when it finished run this command in android directory.
gradlew assembleDebug
But when I run gradlew assembleDebug
command I got following errors.
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found. error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found. C:\Users\Habib M. Farooq.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\96831bdc0a7a4525ff0542204eea37bf\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
C:\Users\Habib M. Farooq.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\96831bdc0a7a4525ff0542204eea37bf\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
C:\Users\Habib M. Farooq.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\96831bdc0a7a4525ff0542204eea37bf\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
C:\Users\Habib M. Farooq.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\96831bdc0a7a4525ff0542204eea37bf\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.
C:\Users\Habib M. Farooq.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\96831bdc0a7a4525ff0542204eea37bf\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/font not found.
C:\Users\Habib M. Farooq.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\96831bdc0a7a4525ff0542204eea37bf\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.
error: failed linking references.
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-keep-awake:verifyReleaseResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
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 5m 5s 120 actionable tasks: 22 executed, 98 up-to-date
I have trying it from yesterday and searched about it too much on google and stackoverflow
but still not find any suitable solution for it.
Kindly please guide me and help to solve it and please don't give thumbs down to this question because it is different and I haven't find any answer of it and and I have did everything to solve it.
Update
I have added some lines which I found on github
and the APK
generates successfully but its not installing in my phone.
And these lines are following:
subprojects {
project.configurations.all {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
}
}
}
}
}
Thank you for your help in advance.