Tag Archives: grade

[Solved] Execution failed for task ‘:app:uploadCrashlyticsMappingFileRelease‘

Problem: Recently, when doing a project, an error occurred in the online package of release:

 Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'

 

Reason: This problem is caused by the use of Google’s firebase library, which is the culprit:

com.google.firebase:firebase-crashlytics

 

Solution: Add the following code to Android {} of gradle of app

gradle.taskGraph.whenReady {
    tasks.each { task ->
        if (task.name.contains("uploadCrashlyticsMappingFileRelease")) {
            task.enabled = false
        }
    }
}

Note: this method can only solve this issue temporary, if you know other solutions, please leave a comment and let me know!

[Solved] Android Studio Generate APK Error: error_prone_annotations.jar (com.google.errorprone:error)

Android Studio failed to generate apk error:

Could not download error_prone_annotations.jar (com.google.errorprone:error)

 

Solution:

Modify the buildscript and allprojects in build.gradle file of your project:

google()jcenter()

to

maven { url ‘https://maven.aliyun.com/repository/google’ }maven { url ‘https://maven.aliyun.com/repository/jcenter’ }maven { url ‘http://maven.aliyun.com/nexus/content/groups/public’ }

Done!

[Solved] AndroidStudio package Invalid keystore format Error: Execution failed for task ‘:examplecases:packageRelease’…

Post error information first

Execution failed for task ':examplecases:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > com.android.ide.common.signing.KeytoolException: Failed to read key aaa from store "C:\Users\a\Desktop\NewProject\aaa.jks": Invalid keystore format

* 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.

 

 

Solution:

Open file -> settings.

Set the JDK version to 11, repack and solve the problem.

[Solved] Phone Debug Program Error: The application could not be installed: INSTALL_FAILED_TEST_ONLY

1. Error message

17:18	Gradle build finished in 2 s 904 ms

17:18	Failed to commit install session 1905086282 with command cmd package install-commit 1905086282. Error: INSTALL_FAILED_TEST_ONLY

17:18	Error
		Installation did not succeed.
		The application could not be installed: INSTALL_FAILED_TEST_ONLY
		Retry

17:18	Session 'app': Installation did not succeed.
		The application could not be installed: INSTALL_FAILED_TEST_ONLY
		Retry

 

2. Solution

1. Problem analysis

 

When you click to run the debugging program, it will be automatically generated in the application tab of the manifest file

android:testOnly="true"

Some mobile phones do not support the installation of such applications;

 

2. Solution 1

Under menu bar/build:

  • Debug apps compiled with Build APK(s) can run;
  • The debug version of the application compiled with Make Project can be run;
  • Released apps packaged with Generate Signed APK signatures will also work;

 

3. Solution 2

Configure in gradle.properties

android.injected.testOnly=false

[Solved] Virtual Machine Error: FAILURE: Build failed with an exception.Flutter

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
   > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://storage.flutter-io.cn/download.flutter.io)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.4/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more 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 50s
Exception: Gradle task assembleDebug failed with exit code 1

 

Solution:

Although there are many tutorials online, but there is no solution to this solution, the early my attention are in the first sentence, only to know that the original focus is the latter sentence, the main error is in the http and https protocol, Just modify HTTP to HTTPS of the system variable FLUTTER_STORAGE_BASE_URL variable value.

[Solved] AndroidStudio Error: Connect to 127.0.0.1:10887 [/127.0.0.1] failed: Connection refused…

 > Connect to 127.0.0.1:10887 [/127.0.0.1] failed: Connection refused (Connection refused)
      > Failed to list versions for com.tencent.bugly:symtabfileuploader.
         > Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/tencent/bugly/symtabfileuploader/maven-metadata.xml.
            > Could not get resource 'https://dl.google.com/dl/android/maven2/com/tencent/bugly/symtabfileuploader/maven-metadata.xml'.
               > Could not GET 'https://dl.google.com/dl/android/maven2/com/tencent/bugly/symtabfileuploader/maven-metadata.xml'.
                  > Connect to 127.0.0.1:10887 [/127.0.0.1] failed: Connection refused (Connection refused)

When I run the android Studio project on my mac computer, I get a bunch of error messages, which I have never touched. In fact, if I analyze the error message calmly, I can know that the configuration of the proxy is the cause, but I have closed the proxy, how can I still report the error, is it caused by the cache? Or is it that there are still proxies for local files.

The reason is that the proxy is set in the local, local, local gradle.properties

Solution: open ~/.gradle/gradle.properties

Open gradle.properties file, comment out or delete the code below directly, clear the cache again, and run it OK.

 

[Solved] Cordova Android Compile Error: Execution failed for task ‘:packageDebug‘

Execution failed for task ‘:packageDebug’

Background

Use ionic+cordova+gradle to package the Android program. The environment is as follows:

    cordova  :  7.1.0
    Gradle  :   7.4
    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0
    

System:

    Node : v6.9.1
    npm  : 3.10.8
    OS   : Windows 10

Misc:

    backend : pro

problem

* What went wrong:
Execution failed for task ':packageDebug'.
> com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store "C:\Users\11644\.android\debug.keystore": Invalid keystore format

Solution:

According to the second paragraph

 Failed to read key AndroidDebugKey from store "C:\Users\11644\.android\debug.keystore": Invalid keystore format

Find the debug.keystore file

delete this file and rerun the command
package successfully

BUILD SUCCESSFUL

Total time: 1.658 secs
Built the following apk(s):
        D:/ProjectFiles/CordovaProject/myapp/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=D:\Programmer\AndroidSDKmange
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_201
No target specified, deploying to device '26395863'.
Skipping build...
Built the following apk(s):
        D:/ProjectFiles/CordovaProject/myapp/platforms/android/build/outputs/apk/android-debug.apk
Using apk: D:/ProjectFiles/CordovaProject/myapp/platforms/android/build/outputs/apk/android-debug.apk
Package name: io.cordova.hellocordova
LAUNCH SUCCESS

[Solved] Manifest merger failed: android:exported needs to be explicitly specified for element <activity#com

Manifest merger failed : android:exported needs to be explicitly specified for element < activity#***

com.tamsiree.rxui.activity.activityWebView***>. Apps targeting Android 12 and higher are required to specify an explicit value forandroid:exportedwhen the corresponding component has an intent filter defined.

**According to the hint, you need to add the dependency package com.tamsiree.rxui.activity.ActivityWebView to the
AndroidManifest.xml file under the activity to add android:exported **

Note that the package name depends on whether it is in your own project or a dependent package. To find it, click on a file on the left and type in what you want to find

Failed to get convolution algorithm. This is probably because cuDNN failed to initialize,

For my personal situation, just add the following code

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"  

gpus = tf.config.experimental.list_physical_devices("GPU")
if gpus:
    try:
        for gpu in gpus:
            tf.config.experimental.set_memory_growth(gpu, True)
    except RuntimeError as e:
        print(e)
        exit(-1)

Reference:

https://stackoverflow.com/questions/53698035/failed-to-get-convolution-algorithm-this-is-probably-because-cudnn-failed-to-in

[Solved] Manifest merger failed with multiple errors, see logs

Manifest merge failed with multiple errors, see logs solution

In component-based development, when testing a single component, such problems sometimes occur in compilation


Simulate with my project:

The current test is lib_news
lib_news requires webView of lib_web

lib_news build gradle

if (isRelease) {
    apply plugin: 'com.android.library'
} else {
    apply plugin: 'com.android.application'
}

apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android{
	……
	defaultConfig {
       ……
        kapt {
            arguments {
                arg("AROUTER_MODULE_NAME", project.getName())
            }
        }
        buildConfigField("boolean", "isRelease", String.valueOf(isRelease))

    }
	sourceSets{
        main {
            if (isRelease) {
                //if library,then compile AndroidManifest.xml in manifest
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            } else {
                //if application, then compile theAndroidManifest.xml in the home directory.
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
    }
    ……
	dependencies{
		……
		implementation project(path: ':lib_web') //import lib_web
	}
	
}

project config.gradle

ext{
    isRelease = false
    //isUseWeb = true Comment first, the general configuration file is only configured with isRelease
	……
}

lib_web build.gradle

if (isRelease) {
    apply plugin: 'com.android.library'
} else {
    apply plugin: 'com.android.application'
}

apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android{
	……
	defaultConfig {
       ……
        kapt {
            arguments {
                arg("AROUTER_MODULE_NAME", project.getName())
            }
        }
        buildConfigField("boolean", "isRelease", String.valueOf(isRelease))

    }
	sourceSets{
        main {
            if (isRelease) {
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            } else {
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
    }
    ……
	dependencies{
		……
	}
	
}

In general, we only set isrelease to determine whether a single component test or integrated compilation
so the test lib_news, directly change isrelease to false, and also lib_web will also become Application, which is equivalent to us in lib_news importing Application instead of Library, will involve the problem of  androidmanifest.xml

Show me androidmanifest.xml
lib_web component mode
Lib_ Web integration mode


Solution:

project config.gradle
add a isuseweb to identify the lib_web to be used in the componentization mode

ext{
    isRelease = false
    isUseWeb = true 
	……
}

Modify lib_webbuild.gradle

if (isUseWeb) {
    apply plugin: 'com.android.library'
} else {
    apply plugin: 'com.android.application'
}
android {
	……
	defaultConfig {
		……
		buildConfigField("boolean", "isUseWeb", String.valueOf(isUseWeb))
	}
	……
	sourceSets{
        main {
            if (isUseWeb) {
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            } else {
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
    }
	
}

[Solved] Android Studio Compile Error: Could not determine java version from ‘11.0.8‘.

There are two solutions to solve Error: Could not determine java version from '11.0.8'.

Method 1: downgrade Android Studio and use the historical version of Android Studio environment;

Method 2: upgrade Gradle version;

1. Error reporting information


 

Open an old project and report the following error:

Could not determine java version from '11.0.8'.

The project uses Gradle version which is incompatible with Studio running on Java 10 or newer.
See details at https://github.com/gradle/gradle/issues/8431
Possible solution:
 - Upgrade Gradle wrapper to 4.8.1 version and re-import the project

Select the “menu bar/file/Project Structure” option,

Check that the Android Gradle plug-in version of the Android project is 3.2.0 and the Gradle version is 4.6. This is the version used a few years ago. At present, the project cannot be compiled using the latest Android studio;

 

 

 

 

2. Solution

Select the menu bar/file/project structure option,

In the pop-up project structure dialog box, update the Android gradle plug-in version to 4.2.1 and the gradle plug-in version to 6.7.1;