Flutter apps not running on android - gradle

Applications are not running on android but running well on ios, error says that there is a problem in gradle although native android projects run well in android studio, I tried google and other threads on stackoverflow with no luck.**
N.B: the error occurs regardless the project, it always happens even with newly created projects in flutter. Thanks
* Error running Gradle:
ProcessException: Process "/Users/apple/Documents/flutter_work/tqtqt/android/gradlew" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.10.2/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error: Could not find or load main class org.gradle.launcher.daemon.bootstrap.GradleDaemon
* 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
Command: /Users/apple/Documents/flutter_work/tqtqt/android/gradlew app:properties
Please review your Gradle project setup in the android/ folder.
build.gradle
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Try to run flutter clean on project folder and run it again.

Related

Could not find guice-4.2.1-no_aop.jar

Could not find guice-4.2.1-no_aop.jar on a newly initialized quarkus project, not sure why we see this error. Source code is available here - https://pastebin.com/9qaTfb7D
./gradlew build
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'foo-receiver'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find guice-4.2.1-no_aop.jar (com.google.inject:guice:4.2.1).
Searched in the following locations:
file:/Users/user/.m2/repository/com/google/inject/guice/4.2.1/guice-4.2.1-no_aop.jar
* 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
I just ran into this and was able to get past that error by modifying the generated settings.gradle file. I moved mavelLocal() to the end of the list of repositories for pluginManagement.
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
mavenLocal()
}
plugins {
id "${quarkusPluginId}" version "${quarkusPluginVersion}"
}
}
In my particular use case, I'm trying to create a subproject in a multi-project Gradle build. Not sure if that's related to this or not.

WildFly 18.0.1.Final - Error fetching WildFly component 'org.picketlink:picketlink-api:::2.5.5.SP12-redhat-00006'

Provision worked fine with WildFly: 16.0.x - 17.0.1.
Upgraded provision.gradle to upgrade to use wildFly 18.0.1.
plugins {
id "org.wildfly.build.provision" version '0.0.11'
}
repositories {
mavenLocal()
mavenCentral()
maven {
name 'jboss-nexus'
url "http://repository.jboss.org/nexus/content/groups/public/"
}
}
provision {
// Optional destination directory:
destinationDir = file("wildfly-as/18.0.1.Final")
configuration = file('wildfly-server-provisioning.xml')
// Define variables which need replacing in the provisioning configuration!
variables['wildfly.version'] = '18.0.1.Final'
variables['hibernate-orm.version'] = '5.3.7.Final'
variables['hibernate-search.version'] = '5.11.0.Final'
variables['hibernate-ogm.version'] = '5.4.1.Final'
}
Causes in:
MacBook-Pro:GoStopHandle NOTiFY$ gradle provision -b provision.gradle
Configure project :
Task :provision FAILED Error fetching WildFly component 'org.picketlink:picketlink-api:::2.5.5.SP12-redhat-00006' from
configured repositories; check your repository configurations to
prevent this problem. Attempting to resolve this by enabling
additional repositories automatically! Adding: [mavenLocal(),
mavenCentral() and
http://repository.jboss.org/nexus/content/groups/public/]
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':provision'.
Could not resolve all dependencies for configuration ':detachedConfiguration67'.
Could not find org.picketlink:picketlink-api:2.5.5.SP12-redhat-00006.
Required by:
project :
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 7.0. Use '--warning-mode all' to show the
individual deprecation warnings. See
https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s 1 actionable task: 1 executed
Any suggestions?
Deleted SDK 14 and 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/'.
You need to add http://maven.repository.redhat.com/ga/ as repository.

PhoneGap - Could not resolve com.android.tools.build:gradle:3.0.1

I am trying to building an android-app with Cordova (PhoneGap) but during building I got an exception:
BUILD FAILED in 11s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.1.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.1.
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> Could not HEAD 'https://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> maven.google.com
> Could not resolve com.android.tools.build:gradle:3.0.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> jcenter.bintray.com
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
gradle-file
buildscript {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
google()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="27.0.1" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
What causes this exception and how do I fix it? It seems like Cordova is looking for an older version of gradle - could I change it somwhere?
Try creating a new project and see if you get the same error.
If that also fails, try updating your cordova version.
npm update -g cordova

gradle dependencyUpdates failure

I have "installed" or included ben manes - gradle versions plugin:
https://github.com/ben-manes/gradle-versions-plugin
The code below is the build.gradle (Project: rewards)
apply plugin: "com.github.ben-manes.versions"
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.github.ben-manes:gradle-versions-plugin:0.20.0"
}
}
When I try to run the following gradle Task: gradle dependencyUpdates.
I get the following :
FAILURE: Build failed with an exception.
What went wrong:
Task 'gradle' not found in project ':app'. Some candidates are: 'bundle'.
Try:
Run gradle tasks to get a list of available tasks. 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 0s
11:23:53: Tasks execution finished 'gradle dependencyUpdates'.
After further testing, I realised that the task that I need to run should not have the word gradle in front. The command line instruction should just be dependencyUpdates. Then click on okay and it will export the report.

Getting spring boot jar files through gradle

The spring framework wants users to use dependency tools to download the framework, so I am trying to use gradle. I got this sample from their website http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto
buildscript {
repositories {
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT")
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
jar {
baseName = 'root'
version = '0.0.1-SNAPSHOT'
}
repositories {
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
I saved this to a file called build.gradle. Then in the CMD I went to the directory where the build.gralde file is located and type:
gradle build
It seemed to run fine but towards the building it's not working, here is the last logs I got from the command prompt:
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:jar
:bootRepackage FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRepackage'.
Unable to find main class
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 9.664 secs
I don't understand this "> Unable to find main class". I only want to get all the jar files and put them inside WEB-INF/lib of my eclipse projects. I am extremely new at gradle. What should I do?
It's not really clear to me, acoording to your comments, what are you trying to achieve, if you don't have a project sources, but for some reason wants to download dependent libraries. Gradle doesn't work this way, all the libraries are dowloded on demand, that means, they are dowloaded then you, for example, try to build your source files.
The exception you get, means, that gradle spring boot plugin's task bootRepackage Didn't find a main class in your project. This main class is mandatory for this task, since the task creates a standalone executable jar.
Sure, it is possble to dowload deps by custom task, like:
task getDeps(type: Copy) {
from sourceSets.main.runtimeClasspath
into 'runtime/'
}
But it seems, that you don't properly understand, how does it work. You should try to read gradle user guide first and let gradle to build your project for you, but not just combine some libs.

Resources