RedPhone Build Failed - gradle

I tried to build Redphone for my android device using gradle.
I always get the following error
FAILURE: Build failed with an exception
* What went wrong:
Execution failed for task ':lint'.
> Lint found errors with abortOnError=true; aborting build.
What exactly is the error and how to correct.
Please Help.

The build can be completed by adding the following to build.gradle
android {
lintOptions {
abortOnError false
}
}
Tried the solution by Scott Barta and Jared Burrows at How to fix error running ./gradlew check connectedCheck, after update AndroidStudio to 0.4.0? and it worked.

Related

In gradle, how to make an existing task "build" depending on the publishing tasks of another module?

When I try to declare the task "build" depends on another task like this:
task("build").dependsOn(
gradle.includedBuild("splain").task("publishToMavenLocal")
)
I got the following error:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/peng/git/shapesafe/build.gradle.kts' line: 35
* What went wrong:
Cannot add task 'build' as a task with that name already exists.
How to fix it?
UPDATE 1: this also doesn't work:
tasks {
build.dependsOn(
gradle.includedBuild("splain").publishToMavenLocal
)
}
e: /home/peng/git/shapesafe/build.gradle.kts:92:15: Unresolved reference: dependsOn
UPDATE 2 the following compiles successfully, but gives a different error:
tasks.build{
dependsOn(
gradle.includedBuild("splain").task("publishToMavenLocal")
)
}
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':core:compileTestScala'.
> Could not resolve all task dependencies for configuration ':core:scalaCompilerPlugins'.
> Could not resolve io.tryp:splain_2.13.8:1.1.0-SNAPSHOT.
Required by:
project :core
> Could not resolve io.tryp:splain_2.13.8:1.1.0-SNAPSHOT.
> Unable to load Maven meta-data from https://dl.bintray.com/kotlin/kotlin-dev/io/tryp/splain_2.13.8/1.1.0-SNAPSHOT/maven-metadata.xml.
> Could not GET 'https://dl.bintray.com/kotlin/kotlin-dev/io/tryp/splain_2.13.8/1.1.0-SNAPSHOT/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
This is problematic as io.tryp:splain_2.13.8:1.1.0-SNAPSHOT should already be published to maven local, the gradle task sequence log further confirmed this view:
:splain:buildSrc:compileKotlin
:splain:buildSrc:compileJava
:splain:buildSrc:compileGroovy
:splain:buildSrc:pluginDescriptors
:splain:buildSrc:processResources
:splain:buildSrc:classes
:splain:buildSrc:inspectClassesForKotlinIC
:splain:buildSrc:jar
:splain:buildSrc:assemble
:splain:buildSrc:compileTestKotlin
:splain:buildSrc:pluginUnderTestMetadata
:splain:buildSrc:compileTestJava
:splain:buildSrc:compileTestGroovy
:splain:buildSrc:processTestResources
:splain:buildSrc:testClasses
:splain:buildSrc:test
:splain:buildSrc:validatePlugins
:splain:buildSrc:check
:splain:buildSrc:build
(no publishToMavenLocal!)
So I just need to trigger it
According to the Gradle document at https://docs.gradle.org/current/userguide/composite_builds.html#included_build_task_dependencies, the task name you are using is missing the colon :. It should be:
tasks.findByPath(":configuration")?.dependsOn( gradle.includedBuild("splain").task(":publishToMavenLocal"))
Edit: the depending task should be :configuration task

Gradle 7.2 Tar task baseName deprecated but replacement archiveBaseName is rejected

I have started using Gradle 7.2 to build a project that produces a compressed Tar archive. Gradle is issuing a deprecation warning that baseName is deprecated and should be replaced with archiveBaseName. But it rejects archiveBaseName.
A very much simplified example using a trivial Gradle build script, with their associated execution outputs are given below. I did run 'gradle --stop' to ensure a prior version's daemon wasn't actually executing; a GRADLE_HOME environment variable is pointing to the correct Gradle folder (not sure it's needed, but it is set.)
I tried using "archiveBaseName" both without and with "=" ("archiveBaseName 'Test'" and "archiveBaseName='Test'").
The docs seem to suggest archiveBaseName should already be available, so I don't think it's just a heads up of things to come.
Thank you!
Gradle file:
task dist(type: Tar) {
baseName 'Test'
into ('.') { from('.') }
}
Execution:
gradle build --warning-mode=all
c:\jdev\newpaas\xxx>gradle build --warning-mode all
> Configure project :
The AbstractArchiveTask.baseName property has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the archiveBaseName property instead. See https://docs.gradle.org/7.2/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:baseName for more details.
at build_2qa2gx0itzunotwyc4ndf9v86$_run_closure1.doCall(C:\jdev\newpaas\xxx\build.gradle:2)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Task :buildEnvironment
------------------------------------------------------------
Root project 'TestProject'
------------------------------------------------------------
classpath
No dependencies
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 983ms
1 actionable task: 1 executed
Gradle file:
task dist(type: Tar) {
archiveBaseName 'Test'
into ('.') { from('.') }
}
Execution:
c:\jdev\newpaas\xxx>gradle build --warning-mode all
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\jdev\newpaas\xxx\build.gradle' line: 2
* What went wrong:
A problem occurred evaluating root project 'TestProject'.
> Could not find method archiveBaseName() for arguments [Test] on task ':dist' of type org.gradle.api.tasks.bundling.Tar.
* 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 1s
Gradle file:
task dist(type: Tar) {
archiveBaseName='Test'
into ('.') { from('.') }
}
Execution:
c:\jdev\newpaas\xxx>gradle dist
> Task :dist FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':dist' (type 'Tar').
- Type 'org.gradle.api.tasks.bundling.Tar' property 'archiveFile' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
1. Assign a value to 'archiveFile'.
2. Mark property 'archiveFile' as optional.
Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#value_not_set for more details about this problem.
* 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 1s
1 actionable task: 1 executed
I stumbled across this syntax and it seems to be working for me:
archiveFileName = "${archiveBaseName}-${archiveVersion}.${archiveExtension}"

Flutter image_picker not working with flutter_plugin_android_lifecycle issue

I have followed all the steps to implement the image picker plugin in a fresh new app.
Added dependencies to pubspec.yaml
dependencies:
image_picker: 0.6.2+3
Added to the menifest
android:requestLegacyExternalStorage="true"
Followed the example code, But I am getting is this error..
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
../project/android/app/src/main/AndroidManifest.xml:9:5-53:19: AAPT: error: attribute android:requestLegacyExternalStorage not found.
and
/Users/.../Documents/_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.8/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:8: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
^
/Users/.../Documents/_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.8/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:22: error: cannot find symbol
public static Lifecycle getActivityLifecycle(
^
symbol: class Lifecycle
location: class FlutterLifecycleAdapter
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> 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
BUILD FAILED in 1s
Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.
Whats the wrong am I doing here!
After an intensive search, i got the clue to solved this issue. The app need to compile against SDK 29, which is the latest buildTool includes the latest changes that were introduced in Android 10.
Inside app level build.gradle file
// ...
android {
compileSdkVersion 29
// ....
defaultConfig {
targetSdkVersion 29
//...
I think this should be mentioned in the image_picker documentation.

How to fix "Could not find or load main class org.gradle.launcher.daemon.bootstrap.GradleDaemon" in flutter?

I have set up my new PC and I'am already having some problems with Flutter. It used to run fine on my older PC.
I've installed Android Studio, Android SDK, Flutter, VS Code with Dart and Flutter plugins, and after that created new flutter project. After connecting my phone to PC and hitting F5 I'm getting this error:
* Error running Gradle:
ProcessException: Process "D:\FlutterProjects\quotes\android\gradlew.bat" 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: D:\FlutterProjects\quotes\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Flutter doctor looks fine.
Here are my gradle-wrapper.properties:
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
And gradle.properties:
org.gradle.jvmargs=-Xmx1536M
org.gradle.daemon=true
org.gradle.parallel=true
And the last thing, build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
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
}
Can anyone help me with that problem?
run
flutter clean
it will clean your current build folder and cache, then when you run your Flutter App, a new Build folder will be created.
in most cases it fix it.

libgdx project generation gradle error

I'm trying to generate a libgdx project but I'm getting the following error related to gradle.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\libgdx\gametest\build.gradle' line: 5
* What went wrong:
Could not compile build file 'C:\libgdx\gametest\build.gradle'.
> startup failed:
build file 'C:\libgdx\gametest\build.gradle': 5: unexpected token: } # line 5, column 5.
}
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Is there any way to fix this? Thanks!
This is really simple. Open the grade file. Change line 5 from
maven { https://oss.sonatype.org/content/repositories/snapshots/ }
to:
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }

Resources