I just started a new gluon mobile multi view project with FXML and tried to run it before changing anything (apart from updating the jfxmobile-plugin version in the build.gradle file from 1.2.0 to 1.3.2). it works fine on desktop, but when i try to run the androidinstall gradle task (with my android phone connected) it fails. It gives me the following error:
:mergeClassesIntoJar
:shrinkMultiDexComponents
:createMainDexList
:writeInputListFile
[ant:java] Java Result: 1
:dex FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dex'.
> org.gradle.api.GradleException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
my build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:4.2.0'
}
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', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
}
operating system: Windows 10.
Please let me know if any additional information is needed to determine the cause of the problem. Thank you.
gradlew --info android log:
http://pastebin.com/yNZbZcVk
Based on your log, I noticed you were using a 32 bits JDK on a 64 bits OS:
Starting process 'command 'C:\Program Files (x86)\Java\jdk1.8.0_101\bin\java.exe''. Working directory: D:\Android_Projects\GluonMobile-MultiViewProjectwithFXML Command: C:\Program Files (x86)\Java\jdk1.8.0_101\bin\java.exe ...
By default, the jfxmobile plugin sets 2 GB for the JVM Xmx option on Android, and considering that on a 32 bits OS that won't be possible to allocate, the solution is setting a lower value.
Based on this line of code, you can set:
android {
dexOptions {
javaMaxHeapSize '1g'
}
}
Or maybe a little bit more (1.5g or so?).
Note that this will be solved if you use a 64 bits JDK. Make sure you update your JAVA_HOME environment variable accordingly, as you won't need to reduce the memory for your process.
Related
I am 10000000000% new to coding forge mods.
I am trying to run this command:
./gradlew setupdecompworkspace
I typed this in the terminal after going through the file path.
I get this error message:
* What went wrong:
Could not compile build file '/Users/fred/Desktop/Mods-In-Progress/LearningMod/build.gradle'.
> startup failed:
build file '/Users/fred/Desktop/Mods-In-Progress/LearningMod/build.gradle': 15: unexpected token: 16.5 # line 15, column 13.
version =‘1.16.5-1.0.0’
^
1 error
* 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 5s
FC-MBP3-3:LearningMod MYNAME$
My build.gradle file is this(I am not showing the whole thing btw):
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version =‘1.16.5-1.0.0’
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'modid'
So, my question is how do I fix the error message. I have tried everything I can think of. I am following this tutorial: https://www.youtube.com/watch?v=JFVFqZo5t5Q
Thanks,
CreativeDrone
Also, I have an old mac. around OS version 10.8 Owo
Gonna get a new one soon
OK SO SOMEONE FIXED THIS PROBLEM BUT I AM STILL GETTING AN ERROR CODE THE ERROR CODE IS IN THE COMMENTS.
You need to use '', not ‘’. Replace that line with version ='1.16.5-1.0.0'.
**I have a problem when im starting a proj in Android studio using Yarn mb someone had the same problem **
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1440 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
Configure project :app
Error 'Plugin-Version' of 'unspecified' for 'com.android.build.gradle.AppPlugin#76a4096' is not a valid version number
OneSignal Warning: Could not get AGP plugin version
Task :invertase_react-native-apple-authentication:parseDebugLibraryResources 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.5/userguide/command_line_interface.html#sec:command_line_warnings
8 actionable tasks: 2 executed, 6 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':invertase_react-native-apple-authentication:parseDebugLibraryResources'.
Could not resolve all files for configuration ':invertase_react-native-apple-authentication:androidApis'.
Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for PlatformAttrTransform: /Users/admin/Library/Android/sdk/platforms/android-29/android.jar.
> /Users/admin/Library/Android/sdk/platforms/android-29/android.jar (No such file or directory)
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 9s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I don't know if this applies to your exact situation, but I had a similar error and solved it by explicity specifying the Kotlin version in the buildscript block in build.gradle, like this:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "22.1.7171670"
kotlinVersion = "1.5.30"
androidXAnnotation = "1.1.0"
androidXBrowser = "1.0.0"
googlePlayServicesVersion = "17.+"
}
repositories {
jcenter()
mavenCentral()
maven { url 'https://www.jitpack.io' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
}
}
I was able to find the Kotlin version in Android Studio under Preferences -> Plugins.
I've updated my Gradle distributionUrl to https://services.gradle.org/distributions/gradle-6.1.1-all.zip from gradle-4.1-all.zip, but when I run ionic cordova run android it reverts itself back to the 4.1-all.zip file. This happens around the time where the terminal comes to:
ANDROID_HOME=C:\Users\me\AppData\Local\Android\SDK
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181
studio
Subproject Path: CordovaLib
Subproject Path: app
which then results in
FAILURE: Build failed with an exception.
*Where:
Build file 'C:\Users\me\Desktop\....\platforms\android\CordovaLib\build.gradle' line 40
* What went wrong:
A problem occurred evaluating project':CordovaLib'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 6.1.1. Current version is 4.1...
Line 40 in this case is apply plugin: 'com.android.library'
The issue I'm seeing is that the Gradle version is reverting itself back to the previous version. How can I get this to stay at version 6.1.1? Is there something wrong with the com.android.library plugin that I should be fixing?
my gradle dependencies are:
classpath 'com.andorid.tools.build:gradle:4.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
my ionic info:
cli packages: (C:\Users\bg21562\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.3
ionic (Ionic CLI) : 3.20.1
global packages:
cordova (Cordova CLI) : 9.0.0 (cordova-lib#9.0.1)
local packages:
#ionic/app-scripts : 3.2.4
Cordova Platforms : android 7.1.4
Ionic Framework : ionic-angular 3.9.9
System:
Android SDK Tools : 26.1.1
Node : v8.11.3
npm : 6.11.3
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Users\Bg21562\AppData\Local\Android\SDK
Misc:
backend : pro
Gradle versions are located in several locations, as it turns out.
In order to fix this, I found the distributionUrl as a variable in the following locations:
platforms\android\cordova\lib\builders\StudioBuilder.js and platforms\android\cordova\lib\builders\GradleBuilder.js
Both of these files include
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-4.1-all.zip';
which of course, needed to be replaced with 6.1.1-all.zip
Make sure to also replace the gradle-wrapper.properties file with the 6.1.1 gradle version.
I also found an option to add an export variable for CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL into the bash profile:
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=http\\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Best answers found here: Cordova build changes distributionUrl in gradle-wrapper.properties file
I'm using Gradle build tool and I can't get the source code and docs for spark-core.
I've already searched and applied:
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
module {
downloadJavadoc = true
downloadSources = true
}
}
But it still doesn't work for me. I suppose I'm missing something like rebuild the whole project or download just these pieces.
I applied ./gradlew cleanIdea idea as well.
When I try to click with pressed command on SparkConf.class I press Download Sources I get Sources not found for: org.apache.spark:spark-core_2.12:2.4.5
And the result from the run tab:
21:11:29: Executing task 'DownloadSources'...
:DownloadSources FAILED
BUILD FAILED
Total time: 0.124 secs
FAILURE: Build failed with an exception.
* Where:
Initialization script '/private/var/folders/06/97bzw1l51r59l65thfzs7hd80000gn/T/ijmiscinit1.gradle' line: 14
* What went wrong:
Execution failed for task ':DownloadSources'.
> Could not resolve all dependencies for configuration ':downloadSourcesFrom_MavenRepo_91653a2f-0439-4794-b77a-3812f9926728'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
21:11:29: Task execution finished 'DownloadSources'.
Here is 2 pretty long task outputs:
DownloadSources --info: https://pastebin.com/D07JmGXT
DownloadSources --stacktrace: https://pastebin.com/6ceKhwrk
Idea.log https://pastebin.com/EQcDxPwb
Latest public Intellij build: 2020.1.1 installed via Toolbox
Latest MacOS: 10.15.4
Java 1.8 jdk-8u251-macosx-x64.dmg, downloaded from oracle.com
Could you please help me to realize what should I do to fix it?
The problem belongs to Scala plugin.
If you face this issue, it doesn't matter on build tool you are using Maven or Gradle probably installation of the Scala plugin solves your problem.
My Intellij report: https://intellij-support.jetbrains.com/hc/en-us/requests/2686145
Well-known bug: https://youtrack.jetbrains.com/issue/IDEA-127193
For the last few days I've been unable to run cordova run android (or rather, ionic run android) to test my Ionic app on my native device. When I run the command, I get the usual metric ton of output, along with 100% CPU usage from several Java Runtime processes, then the build finally fails with the stated in the title. The console shows this (truncated, as there's a ton of output):
:compileDebugNdk UP-TO-DATE :compileDebugSources
:transformClassesWithDexForDebug UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0,
0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:484)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:473)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) FAILED
BUILD FAILED
Total time: 1 mins 40.116 secs
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task :transformClassesWithDexForDebug.
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command
'C:\Program Files\Java\jdk1.8.0_73\bin\java.exe'' finished with
non-zero exit value 2
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Error: Error code 1 for command: cmd with args:
/s,/c,"E:\Documents\GitHub\app.auroras.live\platforms\android\gradlew
cdvBuildDebug -b
E:\Documents\GitHub\app.auroras.live\platforms\android\build.gradle
-PcdvBuildArch=arm -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
I just went and updated any necessary tools and libraries in the Android SDK, then I removed and re-added the Android platform (cordova platform add android), making sure to check that all the relevant platform files were gone, and the project still fails to build.
EDIT: I also ran cordova clean, but that didn't work. It looks like the Google Play Services library is causing my app to hit the 64,000 method limit, but other than manually tweaking my gradle file (which I'm not au fait with yet), I'm not sure how I can shrink that down
EDIT 2: I tried tweaking my build.gradle file to remove the reference to "com.google.android.gms:play-services:+" (which I think is pushing my app above the 65535 method limit) but it just keeps coming back.
I also tried a build-extras.gradle to remove the dependency, but got another error. Ideally I'd like an answer that doesn't require constant re-working every time I want to build my app, but at this stage I'm keen for pretty much anything.
I did recently upgrade cordova, ionic and bower (using npm install -g cordova ionic bower after something went screwy with my %PATH% variable on Windows, but I wouldn't imagine that would break anything.
I'm running Windows 10, x64. java -version reports:
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
Any suggestions?
:transformClassesWithDexForDebug UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0,
0xffff]: 65536
This message sounds like your project is too large.
You have too many methods. There can only be 65536 methods for dex.
Since the gradle plugin 0.14.0 and the Build Tools 21.1.0 you can use the multidex support.
Just add these lines in the build.gradle:
android {
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Also in your Manifest add the MultiDexApplication class from the multidex support library to the application element
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
If you are using a own Application class, change the parent class from Application to MultiDexApplication.
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
For google play service:
Google Play services and DEX method limits
Resource Link:
Configuring Your App for Multidex with Gradle
Optimizing Multidex Development Builds
The routine builds performed as part of the development process with multidex typically take longer and can potentially slow your development process.
In order to mitigate the typically longer build times for multidex output, you should create two variations on your build output using the Android plugin for Gradle productFlavors: a development flavor and a production flavor.
The following build configuration sample demonstrates the how to set up these flavors in a Gradle build file:
android {
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 14
}
}
...
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Resource Link:
DexIndexOverflowException issue after updating to latest appcompat and support library
Unable to execute dex: method ID not in [0, 0xffff]: 65536
Modifying build.gradle directly is not advisable as the changes will be overwritten after building android platform. Any extensions to build.gradle should be done by adding additional file like 'build-extras.gradle' as suggested in official documentation. As suggested by Grayda, the cleaner solution is to use the plugin which does the job like charm.
Came across one more cordova multiplex plugin which does the job and which is active. You can install the plugin using following command:
cordova plugin add https://github.com/solent/cordova-plugin-multidex
Posting the answer as it may benefit someone out there.
In addition to #SkyWalker's answer, I discovered a Cordova multidex plugin that is a lot "cleaner" (that is, no manual modification to your build.gradle files).
You simply install it with cordova plugin add --save https://github.com/jwall149/cordova-multidex and on next build, multidex will be enabled, which will resolve this issue.