Tag Archives: Android

socket java.net.BindException: bind failed: EACCES (Permission denied)

It took a long time today to find out the real problem.

There are two situations most likely to cause the whole exception:

1. No permission is given;

a. Permission application is not added in androidmanifest.xml;

<uses-permission android:name="android.permission.INTERNET"/>

b. The format of permission application is incorrect

<!-- Mistake -->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>

c. The permission is manually shielded by the user;

2. Port less than 1024; Set a larger one, not more than the largest one;

The application could not be installed: INSTALL_FAILED_USER_RESTRICTED

Android studio gives the following error after clicking “run app”

Installation did not succeed.
The application could not be installed: INSTALL_FAILED_USER_RESTRICTED

List of apks:
[0] 'E:\MyProject\xxx\app\build\outputs\apk\debug\xxxxx_.apk'
Installation via USB is disabled.

Troubleshooting steps:

1. It may be that the USB installation is not enabled in the developer option. Check whether it is enabled and try again

2. It is possible that the application tag of androidmanifest.xml has been added

android:appComponentFactory=""
tools:replace="android:appComponentFactory"

Delete this attribute and try again.

How to Solve Error: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

When installing a debug package, the prompt is as follows

C:\Users\test>adb install "C:\Users\test\Downloads\test.apk"
Performing Streamed Install
adb: failed to install C:\Users\test\Downloads\test.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

Solution:

adb install -t "C:\Users\test\Downloads\test.apk"

ADB install has lrtsdg six options

-L lock the application
– R replace the existing application, that is, force installation
– t allow the test package
– s to install the application on the SD card
– D allow it to be installed, that is, the installed version is lower than that on the mobile phone
– G grant all runtime permissions to the application

Failed to find Build Tools revision 30.0.3 [How to Solve]

After we solved the problem of could not resolve com.android.tools.build: gradle: 7.0.2, we reported this error in build output

The most direct solution is to download the version of Android SDK build tools in SDK tools. The path is file >settings> Appearance& Behavior> System Settings> Android SDK> SDK Tools. Unfortunately, I couldn’t download it, so I changed the buildtoolsversion in APP/build.gradle to “31.0.2” of all my current 31.0.2 versions

In the project structure, we have also changed everything, but after running, we still report such an error

After I changed the version to 30.0.2, I still have this problem. Obviously, I have this version, but why not? When I checked my SDK tools, I found that 31.0.0 and 30.0.2/28.0.3/27.0.0 are under Android SDK build tools 31

So I guessed whether it could not be found under the file, so I deleted all except the 30.0.2 version I currently use

Close Android studio and open it again. Success

Android: How to Solve libuv Compile Error

Libuv compiler error resolution libuv compiler Android version error resolution

Error reporting reference articles

report errors

error adding symbols: Archive has no index; run ranlib to add one

libuvcopy 1.42.0
Andro10 64 degrees
kali2021
cmake
ndk21

cmake -DCMAKE_TOOLCHAIN_FILE=/usr/lib/android-ndk/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a .. -DCMAKE_SYSTEM_NAME=Android -DANDROID_NATIVE_API_LEVEL=21

Add-DANDROID_NATIVE_API_LEVEL=21will done, the current version of libuv版do not support thearmeabi-v7a

When the MAC M1 uiautomatorviewer is opened, it displays blank or reports an error

As shown in the following figure: uiautomatorviewer displays blank

Cause: the problem of java version is too new

➜  sdk  ls /Library/Java/JavaVirtualMachines/
jdk1.8.0_161.jdk zulu-17.jdk

Solution: downgrade

The Java version can be downgraded to before 201 or before 51. (the blogger’s 161 failed, which may also be the reason for the M1 chip)
uiautomatorviewer is actually a Java startup script. For example, you can use this command on the Mac to see the real startup command.

bash -x /Users/zhoujing/Library/Android/sdk/tools/bin/uiautomatorviewer

In order to ensure that the uiautomatorviewer can run correctly locally, several jdks can be standby

Link to download old java version: SDK

References:
1. Error reporting after uiautomatorviewer is opened under MAC
2. Learning experience of MAC Android automatic test

error: resource android:attr/lStar not found [How to Solve]

When integrating androidx.activity:activity in Android projects, an error is reported.xxx/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:5395: error: resource android:attr/lStar not found.error: failed linking references.

Analysis.
1. gradle introduces the configuration.

    def activity_version = "1.4.0-alpha02"

    // Java language implementation
    implementation "androidx.activity:activity:$activity_version"
    // Kotlin
    implementation "androidx.activity:activity-ktx:$activity_version"

2. Project gradle configuration:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

3. The project is a brand-new project and kotlin has not been introduced, so it is not a kotlin version number problem.

4. After modifying the compilesdkversion and targetsdkversion to 31, the operation is normal.

[Solved] Failed to install the following Android SDK packages as some licences have not been accepted

Question:
Using the Android SDK outside of Android Studio may explode with the following error

Failed to install the following Android SDK packages as some licences have not been accepted.
patcher;v4 SDK Patch Applier v4
emulator Android Emulator
platforms;android-30 Android SDK Platform 30
tools Android SDK Tools
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

Solution:
input. /sdkmanager --licenses in android/sdk/tools/bin
After authorization you can

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

When the message “manifest merge failed with multiple errors, see logs” is reported, and there is no other prompt, open manifest first to see if there is any error. If there is any error, there will be a red prompt
if there is no error, run the following command on the terminal: gradlew processdebugmanifest — stacktrace
. After running, an error will be displayed. Follow the prompts to modify. The wireframe is marked with an error message.