For the gradle javafx builder I've used the tutorial at: https://bitbucket.org/javafxports/android/wiki/Building%20and%20deploying%20JavaFX%20Applications
I downloaded the runtime from here: https://bitbucket.org/javafxports/android/downloads
I'm using javafx in eclipse. I have tried to build the project with theses parameters:
gradle -PDEBUG -PDIR=C:/Users/spencer/Desktop -PNAME=HelloAndroidWorld -PPACKAGE=com.helloworld -PJFX_SDK=C:/Users/spencer/Downloads/dalvik-sdk-latest/dalvik-sdk/android-tools -PJFX_APP=C:/Users/spencer/Documents/Eclipse/Work" "Space/Interactive" "JavaFX/src -PJFX_MAIN=application.Main.java
Here is the message I got afterwards:
C:\Users\spencer>gradle -PDEBUG -PDIR=C:/Users/spencer/Desktop -PNAME=HelloAndro
idWorld -PPACKAGE=com.helloworld -PJFX_SDK=C:/Users/spencer/Downloads/dalvik-sdk
-latest/dalvik-sdk/android-tools -PJFX_APP=C:/Users/spencer/Documents/Eclipse/Wo
rk" "Space/Interactive" "JavaFX/src -PJFX_MAIN=application.Main.java
:help
Welcome to Gradle 1.12.
To run a build, run gradle <task> ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
BUILD SUCCESSFUL
Total time: 9.871 secs
I cannot find the file on my desktop! When i try adding "createProject" to the end i give me errors.
How do i build a android project?
I am not sure what id did wrong this is my first time trying this please help. All the help so far has been great!
Thanks
you have to give task to a gradle for creating a project give createProject task at the end of all parameters but before that you have to run gradle from your dalvik sdk into the android-tools folder
because it contain the build.gradle file in which createProject task is defined for example
into the command line:
c:\User\dalvik\dalvik-sdk\android-tools> gradle -PDEBUG -PDIR=C:/Users/spencer/Desktop -PNAME=HelloAndroidWorld -PPACKAGE=com.helloworld -PJFX_SDK=C:/Users/spencer/Downloads/dalvik-sdk-latest/dalvik-sdk/android-tools -PJFX_APP=C:/Users/spencer/Documents/Eclipse/Work" "Space/Interactive" "JavaFX/src -PJFX_MAIN=application.Main.java createProject
You haven't run any task. Run gradle tasks to see the list of available tasks. Then pick up a task from the list and run the command once again with task specified. There's also a detailed info:
To run a build, run gradle <task> ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
Related
I am attempting to get
https://github.com/KodeinKoders/Playground-Demo-Crypto (commit 2a9b2b9)
Repository to build.
After doing some updates of tooling MacOS & XCode. And addition of the following override to gradle build file:
tasks.getByName<org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest>("iosX64Test") {
deviceId = "iPhone 14"
}
I am able to build within command line use
gradle build
On
MacOS: 13.2
XCode: 14.2
However, when I run build within IntelliJ. I get the following error:
Task 'compileJava' is ambiguous in root project 'DemoCrypto'. Candidates are: 'compileDebugAndroidTestJavaWithJavac', 'compileDebugJavaWithJavac', 'compileDebugUnitTestJavaWithJavac', 'compileReleaseJavaWithJavac', 'compileReleaseUnitTestJavaWithJavac'.
The IntelliJ notifications show:
Executing tasks: [:compileDebugSources, :compileDebugUnitTestSources, :compileDebugAndroidTestSources, :compileJava, :testClasses] in project /usr/local/workplace/sandbox-kotlin-thorg/Playground-Demo-Crypto
Prior to build failure.
I am new to gradle. I don't know where this list of tasks that intellij chooses to use for build is coming from? I am also confused by fact that running:
grep -r "compileDebugSources" .
From within the project root leads to 0 matches.
So the questions are:
How does IntelliJ choose to use that particular list of tasks to for its build. Given that compileDebugSources doesnt even exist in the project.
Advice on getting the build to work in IntelliJ?
I have created a Flutter project in Android Studio (Bumblebee | 2021.1.1 Patch 3). When I open the android folder in a seperate window, when the gradle syncing is being executed, it fails with the message Gradle project sync failed. Basic functionality(e.g. editing,debugging) will not work properly. I ran ./gradlew --warning-mode all in the command line and it's output is
Configure project :app
The AbstractArchiveTask.destinationDir property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the destinationDirectory property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:destinationDir for more details.
at FlutterPlugin$_addFlutterTasks_closure21$_closure47.doCall(/home/sudipta/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle:863)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveFileName property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:archiveName for more details.
at FlutterPlugin$_addFlutterTasks_closure21$_closure47.doCall(/home/sudipta/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle:864)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Configure project :system_alert_window
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
> Task :help
Welcome to Gradle 6.7.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see a list of command-line options, run gradlew --help
To see more detail about a task, run gradlew help --task <task>
For troubleshooting, visit https://help.gradle.org
The last warning is due to system_alert_window (flutter)plugin that I am using. But these deprecation warnings are causing issues in Android Studio editor so that I am unable to use code completion feature. I don't know why is this happening, since these are only warning messages.
My gradle version is 6.7 and android-gradle version is 4.1.0.
Can anyone please help?
TRY this steps-
Step 1:
Open the gradle.properties file same like given Image-
https://i.stack.imgur.com/S2Y0a.png
Step 2:
Disable android.enableR8=true by adding a # in front:
#android.enableR8=true
Alternatively, you can swap out the R8 for D8, The build system changed to using D8 instead of R8.
android.enableD8=true
I am working on a react native application. when I try to build the applications using react-native run-android the build fails. Here is the output of the error that occurs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
253 actionable tasks: 5 executed, 248 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug
debug Error: Command failed: ./gradlew app:installDebug
at checkExecSyncError (child_process.js:607:13)
at execFileSync (child_process.js:627:13)
at runOnAllDevices (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runOnAllDevices.js:58:39)
at buildAndRun (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:142:41)
at then.result (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:104:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
The application was on a old version of react native (0.48.x) I have updated it to 0.59.10.
What I have done so far:
used jetifier to resolve issues with the plugins.
checked that the build tools version matches the compile sdk version
checked if the emulator is running.
Hence I have tried everything I could to resolve this but had no luck. Please do guide me on how to resolve this issue. Looking forward to your answers.
make sure you have followed all the necessary steps from the upgrade helper https://react-native-community.github.io/upgrade-helper/?from=0.48.0&to=0.59.10
also i would suggest you to upgrade to v0.60+ because there are breaking changes after v0.59.10.
having said that
before you run the app make sure your gradle is clean
run the following command to clean your gradle cd android && ./gradle clean
then later you can navigate back to your app folder cd .. and try and run again react-native run-android
Looks like your packages not working stable with Android side. It's better be update all packages and react native version to their last stable versions.
If you face with too much error while update, you can create fresh new react native project (with same package name with your current project), install all packages (and their dependencies) and copy your current project's source code to your new project.
Android in React Native does not allow similar packages to reside in the project.
In my case I had react-native-cookies and #react-native-cookies/cookies packages that add similar code to the Kotlin file upon build. This causes issue of similar imports in java JDK.
I removed one and it worked.
SOLVED at the same issue:
My solution was at /android/build.gradle file.
Somehow, the buildscript versions were wrong.
Follow the exact same step of RN documentation and make a totally new & clean project.
And compate the /android/build.gradle file > buildscript & dependencies part.
There should be some version differences.
It matters by your own local env settings.
After changing buildToolsVersion, ndkVersion, classpath, it worked fine again!!
also, remove duplicated libraries, as #Nimantha said.
I want to use sync project with gradle file in command line but I dont know how to do
like this :
It besides do ./gradlew build also do other things
For example, in a file is written to a local library name android-test
than in settings.gradle read this file and call include ":${android-test}" .if I use AS sync project with gradle files button,AS can load
module to project , but when I run ./gradlew build, it doesn't work.
But I have developed a plugins, and I want to use this action, so how to call this function ?
Building and syncing from the command line is really simple. In the root of your project you can invoke the gradle wrapper's build command with
./gradlew build
To get a list of all available build tasks for your project:
./gradlew tasks
"./gradlew build" and "./gradlew tasks" in the path of your project.
more commands and steps here:https://developer.android.com/studio/build/building-cmdline.html
The action id is Android.SyncProject, so you can call it in your plugin:
ActionManager.getInstance().getAction("Android.SyncProject").actionPerformed(e);
You can find it in android-plugin.xml, maybe line 161.
Also in SyncProjectAction.java, line 36 you can find its text.
I'm debugging Gradle issues in Android Studio and see references to "Run gradle sync", but I'm not sure how to run this command.
How do I run "Gradle sync" from Android studio or Mac terminal?
Android studio should have this button in the toolbar marked "Sync project with Gradle Files"
EDIT: I don't know when it was changed but it now looks like this:
EDIT: This is what it looks like on 3.3.1
OR by going to File -> Sync Project with Gradle Files from the menubar.
WARNING: --recompile-scripts command has been deprecated since gradle's version 5.0.
To check your gradle version, run gradle -v.
./gradlew --recompile-scripts
it will do a sync without building anything.
Alternatively, with command line in your root project
./gradlew build
It will sync and build your app, and take longer than just a Gradle sync
To see all available gradle task, use ./gradlew tasks
In Android Studio 3.3 it is here:
According to the answer https://stackoverflow.com/a/49576954/2914140 in Android Studio 3.1 it is here:
This command is moved to File > Sync Project with Gradle Files.
Keyboard shortcut lovers can add a shortcut for running gradle sync manually by going to File -> Settings -> Keymap -> Plugins -> Android Support -> Sync Project with gradle files (Right click on it to add keyboard shortcut) -> Apply -> OK and you are done. Choose any convenient key as your gradle sync shortcut which doesnot conflict with any other shortcut key, (I have choosen Shift + 5 as my gradle sync key), so next when you want to run gradle sync manually just press this keyboard shortcut key.
I presume it is referring to Tools > Android > "Sync Project with Gradle Files" from the Android Studio main menu.
gradle --recompile-scripts
seems to do a sync without building anything.
you can enable automatic building by
gradle --recompile-scripts --continuous
Please refer the docs for more info:
https://docs.gradle.org/current/userguide/gradle_command_line.html
Shortcut (Ubuntu, Windows):
Ctrl + F5
Will sync the project with Gradle files.
I think ./gradlew tasks is same with Android studio sync. Why? I will explain it.
I meet a problem when I test jacoco coverage report. When I run ./gradlew clean :Test:testDebugUnitTest in command line directly , error appear.
Error opening zip file or JAR manifest missing : build/tmp/expandedArchives/org.jacoco.agent-0.8.2.jar_5bdiis3s7lm1rcnv0gawjjfxc/jacocoagent.jar
However, if I click android studio sync firstly , it runs OK. Because the build/../jacocoagent.jar appear naturally.
I dont know why, maybe there is bug in jacoco plugin. Unit I find running .gradlew tasks makes the jar appear as well. So I can get the same result in gralde script.
Besides, gradle --recompile-scripts does not work for the problem.
I have a trouble may proof gradlew clean is not equal to ADT build clean. And Now I am struggling to get it fixed.
Here is what I got:
I set a configProductID=11111 from my gradle.properties, from my build.gradle, I add
resValue "string", "ProductID", configProductID
If I do a build clean from ADT, the resource R.string.ProductID can be generated. Then I can do bellow command successfully.
gradlew assembleDebug
But, as I am trying to setup build server, I don't want help from ADT IDE, so I need to avoid using ADT build clean. Here comes my problem.
Now I change my resource name from "ProductID" to "myProductID", I do:
gradlew clean
I get error
PS D:\work\wctposdemo> .\gradlew.bat clean
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\work\wctposdemo\app\build.gradle'
* What went wrong:
Could not compile build file 'D:\work\wctposdemo\app\build.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
If I try with:
.\gradlew.bat --recompile-scripts
I just get error of
Unknown command-line option '--recompile-scripts'.
Anyone wants to use command line to sync projects with gradle files, please note:
Since Gradle 5.0,
The --recompile-scripts command-line option has been removed.
https://docs.gradle.org/5.0/userguide/upgrading_version_4.html#potential_breaking_changes
https://docs.gradle.org/current/userguide/command_line_interface.html
https://github.com/gradle/gradle/issues/1425
From terminal:
gradle prepareKotlinBuildScriptModel
NOTE: you can see what android studio is doing by inspecting the "Build" tab. There will be difference windows inside there. One should be "Sync"