Tag Archives: Android

Android Error: META-INF/DEPENDENCIES [How to Solve]

3 files found with path ‘META-INF/DEPENDENCIES’.
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information

Probably means: Error: Multiple files found in OS independent path ‘META-INF/DEPENDENCIES’
Solution:
Add to the build.gradle where the problem occurs

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}

The general principle is:

In Android gradle construction, it is not allowed to include the same file with the same path in the output multiple times. In your construction, there are two meta-inf/dependencies files from different places. Since your application does not need this file at all, the easiest way is to tell the construction system to ignore it completely, which is the role of the exclude instruction

Another PickFirst instruction tells the build system to keep one copy; There are some details in Android gradle plug-in 0.7.0: “duplicate files during APK packaging”

[Solved] Flutter compile error: Failed to find Build Tools revision 29.0.2

Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
> Failed to find Build Tools revision 29.0.2

This question:

1. Is this version available in the build tools in the SDK? If not, install

2. Your sdk directory has been modified, if you modify it, you need to re-define the sdk path for flutter

flutter config --android-sdk E:/Android_SDK

The E:/Android_SDK at the back is my modified sdk path. After running, restart the compiler and you can compile normally in flutter run

Kotlin activity Startup and Compile Error [How to Solve]

The android project added an activity written in kotlin code and tried to launch the page.
The error is reported as follows:

C:\Users\15901\Desktop\ShangXueTang\app\src\main\java\com\example\shangxuetang\MainActivity.java:41: ����: �Ҳ�������
startActivity(new Intent(MainActivity.this, LifecycleActivity.class));
^
����: �� LifecycleActivity
�: �� MainActivity
1 ������

 

Solution:

    1. Add the following two lines of configuration to build.gradle(:app)
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
    1. add the dependency path.
dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }

[Solved] Android HTTPS request resource or interface error: server certificate

Error log:

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
        at com.android.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(ConscryptFileDescriptorSocket.java:229)
        at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:192)
        at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:149)
        at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
        at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
        at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
        at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
        at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
        at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
        at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:89)
        at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:26)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:100)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:56)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.startNextOrFail(MultiModelLoader.java:164)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onLoadFailed(MultiModelLoader.java:154)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:62)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:276)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
     Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
        at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:646)
        at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:495)
        at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:418)
        at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:339)
        at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
        at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88)
        at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:208)
        at com.android.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(ConscryptFileDescriptorSocket.java:404)
        at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
        at com.android.org.conscrypt.NativeSsl.doHandshake(NativeSsl.java:375)
        at com.android.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(ConscryptFileDescriptorSocket.java:224)
        at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:192) 
        at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:149) 
        at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112) 
        at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184) 
        at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) 
        at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) 
        at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) 
        at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) 
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461) 
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127) 
        at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:89) 
        at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:26) 
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:100) 
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:56) 
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100) 
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.startNextOrFail(MultiModelLoader.java:164) 
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onLoadFailed(MultiModelLoader.java:154) 
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:62) 
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100) 
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70) 
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63) 
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310) 
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:276) 
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393) 

Solution:

package com.ex.pu;

import android.app.Application;

import java.security.SecureRandom;
import java.security.cert.X509Certificate;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

public class CApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        // global handling of certificate issues
        handleSSLHandshake();
    }

    /**
     * handle certificate issues globally
     * Ignore the certificate checksum for https
     * Avoid Glide loading https images reporting errors.
     * javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
     */
    public static void handleSSLHandshake() {
        try {
            TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
                public X509Certificate[] getAcceptedIssuers() {
                    return new X509Certificate[0];
                }

                @Override
                public void checkClientTrusted(X509Certificate[] certs, String authType) { }

                @Override
                public void checkServerTrusted(X509Certificate[] certs, String authType) { }
            }};

            SSLContext sc = SSLContext.getInstance("TLS");
            // trustAllCerts trusts all certificates
            sc.init(null, trustAllCerts, new SecureRandom());
            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
            HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
                @Override
                public boolean verify(String hostname, SSLSession session) {
                    return true;
                }
            });

        } catch (Exception e) {
        }
    }
}

Android Studio compile error: build tools is corrupt [Solved]

Error Messages:
Installed Build Tools revision 32.0.0 rc1 is corrupted. Remove and install again using the SDK Manager.
Problem Cause.
File corruption in buildTools after AndroidSutdio version upgrade.

Solution:
1 Modify d8.bat to dx.bat
2 Modify d8.jar to dx.jar

[Solved] Android Studio Compile Error: Invalid main APK outputs : EarlySyncBuildOutput

Invalid main APK outputs : EarlySyncBuildOutput(type=com.android.build.gradle.internal.scope.InternalArtifactTypeKaTeX parse error: Undefined control sequence: \work at position 65: …on=0, output=F:\ ̲ w ̲ o ̲ r ̲ k ̲\ MobileWMS\app\… APK@1c2249b8 , apkType=MAIN, filtersData=[], version=0, output=F:\work\MobileWMS\app\build\outputs\apk\debug\output-metadata.json)

An error is reported when the version is too low. An error is reported when compiling again
after modifying the gradle version, an error is reported when compiling again, which is caused by the previously compiled APK

Solution:
Click clean project under the build directory to clear the previously compiled data

clear and then compile!

[Solved] Android gradle Error: gradle project sync failed. Please fix your project and try again

Another error was reported during Android development. This is a version error. The first step is to synchronize the versions
error message:
Android studio error: gradle project sync failed. Please fix your project and try again

1. Version synchronization:

1.1 file> sync project with android gradle

If you succeed, you don’t have to look at the following

1.2 error reporting:

It can be seen or not solved:

It should be the version problem. If we can’t download it, we can download it directly manually (check the network first, and the agent has no problem, but it still can’t be solved)

2. Modify proxy parameters:

Agent:

2.1 open file> setting> Search proxy

2.2 configuration information

The address and port of the agent shall be filled in as follows:

URL: http://127.0.0.1:1080/pac

2.3 check whether the Ping is connected

    1. use check connection

      1. enter a website to test: www.baidu.com, and then test: </ OL>

Still not!

3. Manual Download

So let’s continue:

3.1 open the gradle wrapper properties file

3.2 download

Download the gradle in the last line of the website. Note that the version must be consistent. Download whatever he puts down.

3.3 modifying environment variables

Remember to modify the gradle environment variable in the computer:

        1. system environment variable:

          1. path:

3.4 modify the compilation environment configuration

Then unzip it, modify the gradle configuration in the environment, and it’s OK.

You can see that my environment is OK now:

AttributeError: ‘WebDriver‘ object has no attribute ‘w3c‘

Problems encountered in the process of automatic testing of mobile terminal with Python + appnium.

Reason: I reported an error in selenium 3.3.1. After uninstalling selenium, I reinstalled selenium 4.0.0 (installed by default and the latest version). I ran it again and the problem was solved. Only the positioning mode needs to be changed to the latest, otherwise there will be a warning.

The new positioning method of mobile terminal is as follows:

from appium.webdriver.common.mobileby import MobileBy

driver.find_element(MobileBy.ID, "com.tencent.mm:id/hej").click()

Monkey error: error: A RuntimeException occurred [How to Solve]

When running monkey with Xiaomi mobile phone, the following error occurs just after startup:

** Error: A RuntimeException occurred:
java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
	at android.os.Parcel.createException(Parcel.java:2074)
	at android.os.Parcel.readException(Parcel.java:2042)
	at android.os.Parcel.readException(Parcel.java:1990)
	at android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:925)
	at android.hardware.input.InputManager.injectInputEvent(InputManager.java:886)
	at com.android.commands.monkey.MonkeyKeyEvent.injectEvent(MonkeyKeyEvent.java:133)
	at com.android.commands.monkey.Monkey.runMonkeyCycles(Monkey.java:1324)
	at com.android.commands.monkey.Monkey.run(Monkey.java:815)
	at com.android.commands.monkey.Monkey.main(Monkey.java:675)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:380)
Caused by: android.os.RemoteException: Remote stack trace:
	at com.android.server.input.InputManagerService.injectInputEventInternal(InputManagerService.java:740)
	at com.android.server.input.InputManagerService.injectInputEvent(InputManagerService.java:714)
	at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:422)
	at android.os.Binder.execTransactInternal(Binder.java:1021)
	at android.os.Binder.execTransact(Binder.java:994)


** System appears to have crashed at event 1 of 1000000 using seed 200

**Solution**

Turn on USB debugging (security setting) and check the setting ☑️ “It is allowed to modify permissions or simulate clicking through USB debugging”, and it is OK to take off again.

Entry name ‘META-INF/xxx‘ collided [How to Solve]

The following errors are suddenly reported when running the project today:

Entry name ‘META-INF/androidx.vectordrawable_vectordrawable.version’ collided

The reason for the problem is that I have typed the test installation package, and the above problems may occur when running later.

The solution is as follows:

Method 1. Re clean project or rebuild project.

Method 2. App — > build–> outputs–> apk–> debug–> Find the corresponding installation package and delete it.

Unit Android converts c# class to JSON file and reports an error

Original file connection: unity about the error report of newtonsoft. JSON reference!!!! (resolved)_ Xiaoyan can’t write code blog – CSDN blog

I’m afraid the original article will be deleted once.

1、 Download the newtonsoft.json.dll library

https://www.nuget.org/packages/Newtonsoft.Json/

After downloading, change the downloaded file to a. Zip file and unzip it. After decompression, find the newtonsoft.json.dll file in the directory:… \ newtonsoft. JSON. 13.0.1 \ lib \ netstandard2.0 and copy it to the… \ assets \ plugins \ netstandard2.0 directory of unity.

2、 Modify unit settings

ProjectSetting-> Player-> API compatibility level changed to. Net 4. X

Create a new link.xml file in the assets directory of the unity project:

<linker>
	<assembly fullname="System.Core">
		<type fullname="System.Linq.Expressions.Interpreter.LightLambda" preserve="all" />
	</assembly>
</linker>

[Solved] AS Error: Error inflating class android.support.v4.view.ViewPager

There is a problem when using viewpager in XML:
error inflating class android.support.v4.view.viewpager

Solution:

Change android.support.v4.view.viewpager to

androidx.viewpager.widget.ViewPager

If there is still a red exclamation mark, just click
change to android.viewpager.widget.viewpager as prompted.