Tag Archives: Android studio

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

Android Studio – add configuration for Android studio

The following errors occurred:

  Obviously, the ADB is connected to the device, and the gradle compilation has passed, but the device cannot be loaded.

Later, after many attempts, it was found that the SDK version of Android studio just downloaded was too high, so we can choose a lower version.

  After removing the √ in front of 31, I selected the Android 8.0 version. After installation, it will be bound.

Network agent problem: task: preparekotlinbuildscriptmodel up-to-date

The error code is as follows

> Task :prepareKotlinBuildScriptModel UP-TO-DATE
IOException: https://dl.google.com/android/repository/addons_list-3.xml
java.net.ConnectException: Connection refused: connect
IOException: https://dl.google.com/android/repository/addons_list-2.xml
java.net.ConnectException: Connection refused: connect
IOException: https://dl.google.com/android/repository/addons_list-1.xml
java.net.ConnectException: Connection refused: connect
Failed to download any source lists!

The solution is to find the gradle.properties file under the. Gradle file in the user directory, open and delete the proxy configuration, IP and port with proxy (not just IP)!!!! And ports!!)

Android Studio Warning: Process ‘command ‘git‘‘ finished with non-zero exit value 1

At first, I thought it was a JDK problem. Later, I changed the JDK version and did not fix it. Looking up the information on the Internet, we found that it might be a git problem.

Enter git config user. Name in terminal   No corresponding user name was output.

Then configure the user name and mailbox

$ git config --global user.name usename
$ git config --global user.password password
$ git config --global user.password email

Mac Appium Error: Error executing adb Exec. Original error…

Appium error on MAC, error executing ADB exec. Original error

Error message: error executing adbexec. Original error: ‘command’/users/noogler/library/Android/SDK/platform tools/ADB – P 5037 – s clb7n18528000446 shell ‘settings delete global hidden_ api_ policy_ pre_ p_ apps; settings delete global hidden_ api_ policy_ p_ apps; settings delete global hidden_ api_ policy” exited with code 1

Process summary

Error information

: Error executing adbExec. Original error: ‘Command ‘/Users/noogler/Library/Android/sdk/platform-tools/adb -P 5037 -s CLB7N18528000446 shell ‘settings delete global hidden_ api_ policy_ pre_ p_ apps; settings delete global hidden_ api_ policy_ p_ apps; settings delete global hidden_ api_ policy’’ exited with code 1

Process

After clicking the start session button in appium, you can enter the page without screenshot and throw an error. After a long time in Google, stackworkflow, CSDN and GitHub failed to solve the problem for a long time. After updating the bundle tools of Android studio to the Android 11 version, it still has no effect. The SDK version of Android studio has 29 30 31. The Android device version connected to the computer is 10. The calling of the third-party Android SDK has been modified, but there is no solution.

adb shell settings put global hidden_ api_ policy_ p_ apps 1
*adb shell settings put global hidden_ api_ policy_ pre_ p_ Apps 1 reduces the version of appium desktop from 1.21 to 1.17!! So I tried to use version 1.21 on another iMac, and it also started successfully! The result of appium doctor is that all required and optional are installed. The Java SDK version is also 1.8. Try to find the appium configuration file to see if the configuration of 1.21 is different from that of 1.17. Finally, the ADB stopped responding, and the kill – server didn’t respond. It’s better to restart. Fortunately, after the restart, appium version 1.21 also successfully started the session, and no error was reported. 😂😂

Summary

If the results of appium doctor are all installed, there are also versions of Android SDK, JDK version is also 1.8, and so on. Direct suggestion

adb kill-server
adb start-server
adb shell

Maybe it can be solved. If there is no solution, you are welcome to throw out the mistakes and discuss them together. Even if I agree, it is not allowed to reprint