Tag Archives: Android studio

Lamdba in the studio part reports an error. Observe lamdba reports an error but can run

Question:

Ordinary lamdba can be used, such as view. Setonclicklistener {}

Some lamdbas are popular but can run, such as livedata. Observe() {}

solve:

It’s not because the Java version is backward. I updated the kotlin plug-in to solve this problem

Studio even pops up a warning pop-up window of “plug-in needs to be updated” in the lower right corner, but I ignore it everyday… Try to update the Java version and still can’t solve it before you notice it

Errorjava.lang.NullPointerException(no error message)

Solve the error: error: java.lang.nullpointerexception (no error message)

1、 Analyze the cause

Android studio often has dependencies or configuring related errors, which are generally caused by the conflict between Android gradle plugin version and gradle version and project files.

2、 Solution

Change the appropriate Android gradle plugin version and gradle Version (which version is appropriate may need to be tried)

3、 Specific operation

1. Through file – & gt; Project structure… Enter the project structure interface

2. In the project structure interface, select project, click the lower triangle, and select the program version to be installed

Then click OK, and Android studio will automatically make version changes to Android gradle plugin version and gradle version

Note that : Android gradle plugin version matches gradle version. Refer to the link: https://developer.android.com/studio/releases/gradle-plugin?hl=zh -cn

3. Recompile the program and solve the error

Error resource Android datalogcornerradius not found

Error: resource Android: attr/dialogcornerradius not found

1. Problem description

Running the Android studio program generates an error error error: resource Android: attr/dialogcornerradius not found

2. Analyze the causes

Compilesdkversion, buildtoolsversion and targetsdkversion do not match

3. Solutions

Set compilesdkversion and buildtoolsversion to high version and targetsdkversion to low version

4. Specific operation steps

Step 1: check the version numbers of compile SDK version, build tools version and targetsdkversion

Step 2: in the project structure interface, select modules and modify the version numbers of compile SDK version and build tools version

Requirement: compile SDK version and build tools version should be higher than targetsdkversion

Step3: Step 2 after modifying the version number, Android studio will automatically update. After the update, run the program again to solve the error problem.

[Solved] Android Studio Compile error: Cannot use connection to Gradle distribution . as it has been stopped.

Article catalog

1、 Error message II. Solution

 

 

 

 

1、 Error message


 

Cannot use connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-5.6.4-all.zip' as it has been stopped.

 

 

 

 

2、 Solution


 

Occasional errors disappear after recompilation. This problem is encountered only once, and a record is made here;

Android network request framework okhttputils reports an error (okhttp3 cannot be found)

preface

        Okhttputils has always been used in network requests. Recently, gradle was upgraded from 3.2.1 to 4.2.0. The running project reported an error (call could not be found).

         Android studio usage:

                 implementation ‘com.zhy:okhttputils:2.6.2’

Before upgrade

         Android Studio:4.2.0
         Gradle plug-in version: 3.2.1
         Required version of gradle: 4.8.1

After upgrade

         Android Studio:4.2.0
         Gradle plug-in version: 4.2.0
         Required version of gradle: 6.7.1

Operation results

        Error: package okhttp3 does not exist
        import okhttp3.Call;

solve

         New: implementation ‘com. Squareup. Okhttp3: okhttp: 4.9.1’

         I don’t know if there will be problems later. I feel that I still need to change a set of framework. After all, Hongshen has stopped maintenance.

[Solved] Android Studio Error: The binary version of its metadata is 1.5.1, expected version is 1.1.15.

Question:

Android studio reports an error: module was compiled with an incompatible version of kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
Solution 1:

Add ext.kotlin in build.gradle of the project_ Version = "1.3.72" (lower version) changed to ext.kotlin_ Version = "1.5.21" (not necessarily 1.5.21, but also the latest version). Just sync and run again

Solution 2:

Open build.gradle under your module (my module name here is MyLibrary) directory, delete some lines in dependencies, and only the corresponding lines in the second figure are left. Just run it again

these lines remain:

[Solved] Ktolin Android Project Compile Error: w: Runtime JAR files in the classpath should have the same version. These file

I haven’t opened the Android project for a while; Open compilation and report an error
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
e: D:/software/Gradle_ workplace/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.5.10/6b84d926e28493be69daf673e40076f89492ef7/kotlin-stdlib-common-1.5.10.jar!/ META-INF/kotlin-stdlib-common.kotlin_ Module: module was compiled with an incompatible version of kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.13.
insert a picture description here

the final solution is:

add this dependency; Implementation “androidx. Core: core KTX: +”
remove it and you can compile it;

Feeling is conflict; Moreover, this feeling at the beginning of Android x is prone to conflict sometimes. After all, the dependence on the new package name feels unstable. If there is a problem in the future, just lean in this direction;

The boss who knows the problem can also give advice;

Environment:
kotlin version is 1.3.11
JDK is 1.8
gradle is 4.6
Android studio is 4.1.3

[actual record of Android stepping on the pit] Android studio runs with errors. Installed build tools revision 31 is broken

The IDE advised me to reinstall the build tools. After many times of reinstallation, I still reported an error. Then I saw that there was an error in the version 30 of my brother online, and then it was reduced to 29. If I had passed the build, I reduced 31 to 30, and then it passed
obviously, the compatibility and stability of the new version are poor
in the Android of the global build.gradle,
change 31 to 30, as shown in the figure below.
resync and then build.

Android studio installation virtual machine error ® HAXM installation failed.

Android studio virtual machine installation error

Intel ® HAXM installation failed. To install Intel ® HAXM follow the instructions found at: https://github.com/intel/haxm/wiki/Installation-Instructions-on-Windows

After consulting the online materials, it is said that the problems and solutions such as AMD processor and BIOS settings can be checked in this article

My computer is Huawei matebook13, which is definitely not a processor problem. Then I opened the official git address and found out the solution:

Open haxm official Git

 

Click download    haxm-windows_ v7_ 7_ 0.zip, unzip and install the EXE file inside.

After installation, look at Android studio and the problem is solved.

[problem record] installed build tools revision 31.0.0 is broken during Android studio compilation

Error: * * build tool 31.0.0 is missing DX at XXXX (SDK installation address) * * the same error as the title

resolvent

do not use the latest build tools, uninstall the latest packaging tool

Use a different version of build tools instead

Step 1: set up the SDK manager

The setting method is as follows:

    in the top column, select toolsdkmanager, remove the check of Android API 31 and apply SDK platforms as needed, such as Android 11.0 ®, And apply

    The completion result is shown in the figure:

    The second step is to set up the build.gradle file

    1、 Open the build.gradle file in the location shown in the figure
    note: the second build.gradle file opens here. When the mouse is over, module: modulename.app displays

    2、 Modify the contents of the build.gradle file as shown in the figure

    PS: find the SDK version number used by the current simulator

    The current simulator uses the SDK version, which can be viewed by clicking AVD manager in the upper right corner

    or after modifying targetsdkversion, directly click sync and modify it according to the corresponding warning information.

    reference resources:

      [problem record] unity package Android error: & gt; Failed to find build tools revision 30.0.0unity package APK error: failed to find build tools revision 31.0.0 or other versions of Android studio installation, the most detailed in history (more pictures)!! Installation of Android studio (the problem of gradle failure in the supplement is updated on March 10, 2021)

      Thanks to the author of the above article