I am trying to make my application run on an android device by using the jfxmobile-plugin.
Finally an
gradle androidInstall
passes throught and the apk is installed on my device.
My gradle file is this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
mainClassName = 'de.package.of.application.ClientApp'
dependencies {
compile 'com.annimon:stream:1.0.1'
compile 'com.jakewharton.threetenabp:threetenabp:1.0.4'
compile 'com.gluonhq:charm:4.2.0'
androidRuntime 'com.gluonhq:charm-android:3.0.0'
iosRuntime 'com.gluonhq:charm-ios:3.0.0'
desktopRuntime 'com.gluonhq:charm-desktop:3.0.0'
compile fileTree(dir: 'target/dependencies', include: '*.jar')
runtime fileTree(dir: 'target/dependencies', include: '*.jar')
}
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
jfxmobile {
ios {
forceLinkClasses = ['ensemble.**.*']
}
android {
//manifest = 'AndroidManifest.xml'
compileSdkVersion = '21'
androidSdk='C:/Tools/android-sdk-windows'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
//... some more excludes
}
dexOptions {
javaMaxHeapSize '3g'
keepRuntimeAnnotatedClasses false
}
}
}
When the app is started on the device a black screen appears for some seconds and then a message pops up: 'application stopped'.
I connected to the device with
adb logcat -v threadtime
The log contains several exceptions which I will list here:
01-15 18:11:09.356 16952 16952 E dalvikvm: Unable to extract+optimize DEX from '/data/data/de.package.of.application/code_cache/secondary-dexes/de.package.of.application-1.apk.classes6.zip'
......
01-15 18:11:09.366 16952 16952 W MultiDex: Exception in makeDexElement
01-15 18:11:09.366 16952 16952 W MultiDex: java.io.IOException: unable to open DEX file
.....
01-15 18:11:09.376 16952 16952 E MultiDex: Multidex installation failure
01-15 18:11:09.376 16952 16952 E MultiDex: java.lang.NoSuchFieldException: Field dexElementsSuppressedExceptions not found in class dalvik.system.PathClassLoader
.....
java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.RuntimeException: Multi dex installation failed (Field dexElementsSuppressedExceptions not found in class dalvik.system.PathClassLoader).
...
01-15 18:11:09.386 16952 16952 E AndroidRuntime: Caused by: java.lang.RuntimeException: Multi dex installation failed (Field dexElementsSuppressedExceptions not found in class dalvik.system.PathClassLoader).
01-15 18:11:09.386 16952 16952 E AndroidRuntime: at android.support.multidex.MultiDex.install(MultiDex.java:178)
The AndroidManifest.xml is the 'default-generated by the plugin' one, which is used when no manifest-file is defined in the gradle-file (as the documentation says).
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.package.of.application" android:versionCode="1" android:versionName="1.0">
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<application android:label="main-client" android:name="android.support.multidex.MultiDexApplication">
<activity android:name="javafxports.android.FXActivity" android:label="main-client" android:configChanges="orientation|screenSize">
<meta-data android:name="main.class" android:value="de.package.of.application.ClientApp"/>
<meta-data android:name="debug.port" android:value="0"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
What I also tried so far:
update IDE gluon-plugin for eclipse to recent version (2.4.0)
generated a new project and compared the generated gradle-file and androidManifest.xml-file with my files from above -> I cannot see
real differences except from my additional required lines.
Does anyone have suggestions?
Related
I am receiving errors when trying to bundle an android release for a react-native project. This project should be converted to AndroidX as a note.
Error Messages
When trying to build a release build for Android I receive the following errors:
* What went wrong:
Execution failed for task ':react-native-vector-icons:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/.../.gradle/caches/transforms-2/files-2.1/5c74eb36d229b35abeeb690f5d3b91a3/appcompat-1.0.0/res/values-v28/values-v28.xml:5:5-8:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
/Users/.../.gradle/caches/transforms-2/files-2.1/5c74eb36d229b35abeeb690f5d3b91a3/appcompat-1.0.0/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
/Users/.../.gradle/caches/transforms-2/files-2.1/f54ae08833e39bf2b75fd420ffea65b9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/.../.gradle/caches/transforms-2/files-2.1/f54ae08833e39bf2b75fd420ffea65b9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
Root Build.gradle file
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0-alpha1"
reactNativeVersion = "0.59.9"
}
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath('com.android.tools.build:gradle:3.6.3')
classpath 'com.google.gms:google-services:4.2.0'
// Add the Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
}
}
allprojects {
repositories {
google()
mavenLocal()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
// React native video - exoplayer missing from google repos, temp fix
maven {
url "https://google.bintray.com/exoplayer/"
}
jcenter()
}
}
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0-alpha1"
reactNativeVersion = "0.59.9"
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion compileSdkVersion
buildToolsVersion "$buildToolsVersion"
}
}
}
}
App build.gradle file
dependencies
dependencies {
implementation project(':react-native-safe-area-context')
implementation 'com.android.support:support-annotations:28.0.3'
implementation "androidx.annotation:annotation:1.1.0"
implementation project(':react-native-video')
implementation(project(":react-native-google-signin"))
implementation project(':react-native-splash-screen')
implementation project(':react-native-iap')
implementation project(':react-native-version-check')
implementation project(':react-native-vector-icons')
implementation project(':react-native-linear-gradient')
implementation(project(':react-native-firebase')) {
transitive = false
}
implementation project(':react-native-fbsdk')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-vector-icons')
implementation project(':react-native-fbsdk')
implementation project(':react-native-vector-icons')
// react-native-google-signin
// react-native-fbsdk
implementation 'com.facebook.android:facebook-android-sdk:4.33.0'
implementation project(':react-native-fbsdk')
// RNFirebase required dependencies
implementation "com.google.firebase:firebase-core:16.0.9"
implementation "com.google.android.gms:play-services-base:17.0.0"
// RNFirebase optional dependencies
implementation "com.google.firebase:firebase-auth:17.0.0"
implementation "com.google.firebase:firebase-database:16.0.5"
implementation "com.google.firebase:firebase-firestore:17.1.4"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation ("com.facebook.react:react-native:0.59.9") {force = true} // From node_modules
implementation 'com.google.firebase:firebase-crashlytics:17.0.1'
}
Research
I have seen some other issues of this being reported such as:
React-native(android) AAPT: error: resource android:attr/dialogCornerRadius not found
https://fincoapps.com/error-resource-androidattr-dialogcornerradius-not-found/.
However, these look to be setup as you'd expect. One issue suggests the subprojects edit that exists in the root build.gradle file, but the same error messages always occur.
Edit
gradle-wrapper.properties
#Thu May 07 14:26:41 BST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
android.enableJetifier=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
android.useAndroidX=true
React-native info
npmPackages:
react: ^16.7.0 => 16.13.1
react-native: 0.59.9 => 0.59.9
npmGlobalPackages:
react-native-cli: 2.0.1
Solution 1:
Check what all react native projects are supporting androidX now.
gradlew app:dependencies
Search for androidX in the output. Get all the libraries having androidx.
Make a change in build.gradle inside android/app
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-gcm:16.1.0'
force 'com.google.android.gms:play-services-basement:16.2.0'
force 'com.google.android.gms:play-services-auth:16.0.1'
force 'com.google.firebase:firebase-messaging:18.0.0'
force 'com.google.firebase:firebase-common:17.0.0'
force 'com.google.firebase:firebase-iid:18.0.0'
force 'com.google.android.gms:play-services-stats:16.0.1'
force 'com.google.android.gms:play-services-base:16.0.1'
}
}
These were the libraries that caused problem in my react native project.
Google maintains all the releases here https://developers.google.com/android/guides/releases#may_07_2019 . You can choose any other version also. This solution solved issue in my case. Let me know if this helps.
Solution 2
rm -rf android/.gradle
rm -rf .gradle
rm -rf ~/.gradle
./gradlew clean
I am beginner in react-native and trying to install react-native-maps in my react-native android app by following this tutorial.
After making all changes, including this, I am getting following error:-
Execution failed for task ':app:processDebugResources'.
Complete Traceback is as follows:-
Scanning folders for symlinks in /home/vineet/test/maps4/node_modules (9ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
> Configure project :app
WARNING: The specified Android SDK Build Tools version (25.0.1) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Checking the license for package Android SDK Platform 23 in /home/vineet/Android/Sdk/licenses
License for package Android SDK Platform 23 accepted.
Preparing "Install Android SDK Platform 23 (revision: 3)".
"Install Android SDK Platform 23 (revision: 3)" ready.
Installing Android SDK Platform 23 in /home/vineet/Android/Sdk/platforms/android-23
"Install Android SDK Platform 23 (revision: 3)" complete.
"Install Android SDK Platform 23 (revision: 3)" finished.
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.
> Configure project :react-native-maps
WARNING: The specified Android SDK Build Tools version (25.0.1) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
/home/vineet/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/33cf2996857d19942091152cf6b82923/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
/home/vineet/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/33cf2996857d19942091152cf6b82923/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
/home/vineet/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/33cf2996857d19942091152cf6b82923/res/values-v26/values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/home/vineet/test/maps4/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-v26/values-v26.xml:7: error: resource android:attr/colorError not found.
/home/vineet/test/maps4/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-v26/values-v26.xml:11: error: resource android:attr/colorError not found.
/home/vineet/test/maps4/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-v26/values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
error: failed linking references.
> Task :app:processDebugResources FAILED
Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at sun.reflect.GeneratedMethodAccessor182.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:59)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:128)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:314)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:204)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:134)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:109)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:69)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 123 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> 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
Following are the changes in files:-
android/app/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.maps4"
minSdkVersion 16
targetSdkVersion 22
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 {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:25.0.1"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-maps')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
package.json
{
"name": "maps4",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-maps": "0.21.0"
},
"devDependencies": {
"babel-jest": "24.9.0",
"babel-preset-react-native": "^5",
"jest": "24.9.0",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
ext {
buildToolsVersion = "25.0.1"
minSdkVersion = 16
compileSdkVersion = 23
targetSdkVersion = 22
supportLibVersion = "25.0.1"
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
settings.gradle
rootProject.name = 'maps4'
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':app'
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maps4">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:allowBackup="false"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="API_KEY"
/>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
MainApplication.java
package com.maps4;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.airbnb.android.react.maps.MapsPackage;
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 MapsPackage()
);
}
#Override
protected String getJSMainModuleName() {
return "index";
}
};
#Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
#Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
I have tried many times to install react-native-maps but couldn't. Are there any other library for react-native to include maps?
as I can see from your package json you are using an old version of both react-native and react-native-maps
"react-native": "0.56.0",
"react-native-maps": "0.21.0"
I suggest you to update to the latest ones if possible.
I'm using react-native 0.60.5 and react-native-maps 0.25.0 in production with AndroidX support.
gradle.properties
android.useAndroidX=true
android.enableJetifier=true
If you cannot update I suggest you to open the project with Android Studio and check with gradle sync if there are any suggestions from the IDE.
Since in react-native-0.60 and higher, there is autolinking, therefore you need not to run react-native link <package-name> command. After following installation documentation for all versions section, if your app crashs when you try to open it, then add following line in android/app/src/main/AndroidManifest.xmml:-
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
For more information on crash issue, you can check this out.
android:style/TextAppearance.Material.Widget.Button.Borderless.Colored was added in API 24 so you can't use it with version 23. You can use a style that was added before version 23.
// android/build.gradle inside allprojects {
subprojects {
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
}
}
}
}
Please don't mark this as duplicate. I've spent two days scouring Github, Stack, Android Studio docs, RN docs, and Gradle docs looking for an answer.
The Problem
Our React Native project won't build on Android. One build error is
Could not find com.github.wix-playground:ahbottomnavigation:2.4.9
The fix for this error is to add maven { url 'https://jitpack.io' } to the project build.gradle
After adding this, however, we get a second error, which is
Execution failed for task ':react-native-ble-plx:compileDebugJavaWithJavac'
The fix for this is adding maven { url 'https://maven.google.com' } to build.gradle
But after adding this second fix, we trigger the first error again.
The Question
Is there a way to list both maven { <url> }s in build.gradle in such a way the each maven { <url> } is used only for the specific dependency relying on it?
OR
Can we force the same support library version across all dependencies?
I have tried numerous methods from these Gradle Docs
I've tried the answer in this Stack Post
I've updated to Android Studio 3.4.1
Any help would be greatly appreciated.
Our Files
Project level build.gradle
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
mavenLocal()
// maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
maven {
url "$rootDir/../node_modules/react-native/android" // This URL still works
}
}
}
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "28.0.0"
}
subprojects { subproject ->
afterEvaluate {
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("reactNative51") || names.contains("reactNative56")) {
setIgnore(true)
}
}
}
}
}
}
app/build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: "com.android.application"
apply plugin: "io.fabric"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
repositories {
maven { url 'https://maven.fabric.io/public' }
}
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
bundleInStaging: true,
devDisabledInStaging: true,
inputExcludes: ["ios/**", "__tests__/**", "bundle_out/**"]
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def debugKeystorePropertiesFile = rootProject.file("keystores/debug.keystore.properties");
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
def releaseKeystorePropertiesFile = rootProject.file("keystores/release.keystore.properties");
def releaseKeystoreProperties = new Properties()
releaseKeystoreProperties.load(new FileInputStream(releaseKeystorePropertiesFile))
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example"
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative55"
minSdkVersion 21
targetSdkVersion 28
versionCode 177
versionName "2.0.4"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [
FABRIC_API_KEY: project.env.get("FABRIC_API_KEY"),
FABRIC_SECRET: project.env.get("FABRIC_SECRET")
]
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
debug {
storeFile file(keystoreProperties['key.store'])
storePassword keystoreProperties['key.store.password']
keyAlias keystoreProperties['key.alias']
keyPassword keystoreProperties['key.alias.password']
}
release {
storeFile file(releaseKeystoreProperties['key.store'])
storePassword releaseKeystoreProperties['key.store.password']
keyAlias releaseKeystoreProperties['key.alias']
keyPassword releaseKeystoreProperties['key.alias.password']
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "proguard-devsupport.pro"
testProguardFile 'proguard-debug.pro'
}
staging {
signingConfig signingConfigs.debug
matchingFallbacks = ['release', 'debug']
}
debug {
signingConfig signingConfigs.debug
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
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
}
}
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support' && requested.name != 'multidex') {
details.useVersion "${rootProject.ext.supportLibVersion}"
}
}
}
dependencies {
compile('com.google.android.gms:play-services-gcm:11.8.0') {
force = true
}
compile project(':react-native-push-notification')
implementation project(':react-native-awesome-card-io')
implementation project(':react-native-fabric')
implementation project(':react-native-randombytes')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-spinkit')
implementation project(':react-native-keychain')
implementation project(':react-native-vector-icons')
implementation project(':react-native-ble-plx')
implementation project(':react-native-config')
implementation project(':react-native-sentry')
implementation project(':react-native-device-info')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:appcompat-v7:27.1.0"
implementation 'com.android.support:design:27.1.0'
implementation "com.facebook.react:react-native:+" // From node_modules
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3#aar') {
transitive = true;
}
implementation project(':react-native-navigation')
implementation project(':react-native-tcp')
implementation 'com.android.support:design:25.4.0'
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation 'com.android.support:multidex:1.0.3'
implementation ('com.github.wix-playground:ahbottomnavigation:2.4.9') {
exclude group: "com.android.support"
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:name="android.support.multidex.MultiDexApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:allowBackup="false"
android:fullBackupContent="false"
android:theme="#style/AppTheme">
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="YOUR NOTIFICATION CHANNEL NAME"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="#android:color/white"/>
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="${FABRIC_API_KEY}"
/>
<meta-data
android:name="io.fabric.ApiSecret"
android:value="${FABRIC_SECRET}"
/>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
Is there a way to list both maven { }s in build.gradle in such a way the each maven { } is used only for the specific dependency relying on it?
Matching repositories to dependencies is an incubating feature.
Currently you can check the official doc about defining multiple repo:
You can define more than one repository for resolving dependencies. Declaring multiple repositories is helpful if some dependencies are only available in one repository but not the other.
The order of declaration determines how Gradle will check for dependencies at runtime. If Gradle finds a module descriptor in a particular repository, it will attempt to download all of the artifacts for that module from the same repository. You can learn more about the inner workings of Gradle’s resolution mechanism.
Also
Can we force the same support library version across all dependencies?
You can:
Exclude the conflicted module/library from one of the dependencies
explicitly declare the support library version
ex:
ex:
implementation "your dependency:$version" {
exclude group: "org.xxxx.xxx", module: "xxxxxxx"
}
use a resolutionStragety, something like:
ex:
android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-xxxx:XX.YY.ZZ'
}
}
Pay attention to this approach because you could going to force the use of a backward version in some libraries.
We used the resolution strategy (see comment above) to fix our issue. Also, in our app/build.gradle we decided against using androidx support library implementations and instead used the older com.android.support:xxx libraries. In the end the solution looked something like this.
app/build.gradle
// Force the same support library version across all dependencies
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support' && requested.name != 'multidex') {
details.useVersion "${rootProject.ext.supportLibVersion}"
}
}
}
implementation 'com.android.support:design:25.4.0'
implementation 'com.android.support:appcompatv7:${rootProject.ext.supportLibVersion}'
using this add multiple dependency at a single command
yarn add react-native-gesture-handler react-native-modal-dropdown react-native-vector-icons react-navigation
npm install --save react-native-gesture-handler react-native-modal-dropdown react-native-vector-icons react-navigation
as well use react native version wise
react-native init --version="react-native#0.36.0" MyNewApp
react-native init --version="react-native#0.59.8" MyNewAppName
How can I use android notifications in gluon?
I used the below code, but the notification doesn't run. Maybe it doesn't find LocalNotification Service?
Services.get(LocalNotificationsService.class).ifPresent(service
->
{
service.getNotifications().add(new Notification(
notificationId, "Sample Notification Text",
ZonedDateTime.now().plusSeconds(10), ()
->
{
Alert alert = new Alert(AlertType.INFORMATION,
"You have been notified!");
Platform.runLater(() -> alert.showAndWait());
}));
});
manifiest:
<activity android:name="javafxports.android.FXActivity" android:label="GluonApplication1" android:configChanges="orientation|screenSize">
<meta-data android:name="main.class" android:value="com.gluonapplication1.GluonApplication1"/>
<meta-data android:name="debug.port" android:value="0"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.gluonhq.impl.charm.down.plugins.android.NotificationActivity"
android:parentActivityName="javafxports.android.FXActivity">
<meta-data android:name="android.support.PARENT_ACTIVITY"
android:value="javafxports.android.FXActivity"/>
</activity>
<receiver android:name="com.gluonhq.impl.charm.down.plugins.android.AlarmReceiver" />
<service
android:name="com.gluonapplication1.MyIntentService"
android:exported="false">
</service>
EDIT
Dependencies included in the build.gradle file:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.gluonhq:charm:4.2.0'
compile 'com.gluonhq:charm-down-common:2.0.1'
compile group: 'com.gluonhq', name: 'charm-down-plugin-local-notifications', version: '3.1.0'
compile 'org.apache.commons:commons-lang3:3.5'
desktopRuntime 'org.xerial:sqlite-jdbc:3.15.1'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
}
Based on the list of your dependencies, you are not adding the android ones, and you are not using the new downConfig configuration to include the Charm Down plugins. Read here the changes in the build script using the jfxmobile plugin 1.1.0+.
You will need to change your build.gradle file at least to include this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.2.0'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'your.main.class.Name'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.gluonhq:charm:4.2.0'
compile 'org.apache.commons:commons-lang3:3.5'
desktopRuntime 'org.xerial:sqlite-jdbc:3.15.1'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
}
jfxmobile {
downConfig {
version = '3.1.0'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'local-notifications', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
I'm creating different flavors using gradle for 2 small android apps ,i wanna just know if i can edit app name on the xml file in the build.gradle , for my different flavors .
What do you mean by app name? the application package name in the manifest or the application name as it appears in the launcher?
If the former, do:
android {
productFlavors {
flavor1 {
packageName 'com.example.flavor1'
}
flavor2 {
packageName 'com.example.flavor2'
}
}
}
It's possible to override the app name as well but you'd have to provide a flavor overlay resource instead.
So create the following files:
src/flavor1/res/values/strings.xml
src/flavor2/res/values/strings.xml
And in them just override the string resource that contains your app name (the one that your manifest use for the main activity label through something like #string/app_name). You can also provide different translations as needed.
You can use resValue, eg.
debug {
resValue 'string', 'app_name', '"MyApp (Debug)"'`
}
release {
resValue 'string', 'app_name', '"MyApp"'
}
Make sure your AndroidManifest uses android:label="#string/app_name" for the application, and remove app_name from strings.xml as it will conflict with gradle's generated strings.xml when it tries to merge them.
Actually... For a more definitive explanation;
In main build.gradle :
ext {
APP_NAME = "My Fabulous App"
APP_NAME_DEBUG = "My Fabulous App debug"
}
In app build.gradle :
android {
buildTypes {
debug {
manifestPlaceholders = [appName: APP_NAME_DEBUG]
}
release {
manifestPlaceholders = [appName: APP_NAME]
}
}
}
so in AndroidManifest.xml
<application
...
android:label="${appName}"
>
is possible. Voilà! you have different application names for release and debug.
This answer is based on Tom's, it works the best and you can work with gradle.properties to allow further animation in build process.
In build.gradle:
debug {
resValue 'string', 'app_name', APP_NAME
}
In gradle.properties:
APP_NAME="Template 1"
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.myapp">
<application
tools:replace="android:label"
android:label="${appName}"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="${appName}"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Gradle
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
// manifestPlaceholders = [appName: appConfig.appName]
manifestPlaceholders = [appName: "Your app Name"]
}
debug {
signingConfig signingConfigs.release
// manifestPlaceholders = [appName: appConfig.appName]
manifestPlaceholders = [appName: "Your app Name"]
}
}