Tag Archives: Android

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.

android remount of /system failed: Read-only file system [How to Solve]

Problems encountered:
after ADB root (obtaining root permission), execute ADB remount (adding read-write permission to system files/system,/vendor,/OEM) and report:
remount of/system failed: read-only file system error

Solution:
1. ADB disable verity will appear
verity disabled on/system
now reboot your device for settings to take effect
2. ADB reboot restart the device.
then remout can succeed

Manifest merger failed: android:exported needs to be explicitly specified for . Apps targ

Manifest merger failed : android: exported needs to be explicitly specified for. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

Solution: In the Activity with the intent, add android:exported="true"

<activity android:name=".MainActivity"
            android:exported="true">
      <intent-filter>
          <action android:name="android.intent.action.MAIN" />

          <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
</activity>

Execution failed for task ‘:app:stripDebugDebugSymbols‘.

Android compilation error

Execution failed for task ‘:app:stripDebugDebugSymbols’.

Specific:

solve:

The solution is also given above, that is, an appropriate NDK version is required. Then you can specify the NDK version in build.gradle
 

android {

    ......


    ndkVersion "22.1.7171670"
} 

 

Then compile again and there will be no problem.

ps:

The key to this problem is that it can run normally a few days ago, but it can’t run now!

In retrospect, I upgraded NDK two days ago. It should be caused by this reason.

Manifest merger failed with multiple errors

Androidmanifest.xml integration failed
my solution is:
build.gradle in the app

android {
    compileSdkVersion 30

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 202
   }
}

Build.gradle in the module, plus buildtoolsversion “29.0.0”

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
   }
}

[Solved] INSTALL_FAILED_DEXOPT (DEX optimization verification failed)

Phenomenon: APK installation of some mobile phones (system 5.0 11 model, system version is uncertain) fails, and the operation code is as follows:

The installation did not succeed.
The application could not be installed: INSTALL_FAILED_DEXOPT (DEX optimization verification failed)

List of apks:
[0]  ‘ D:\workspace\WalletHelper\app\build\outputs\apk\debug\app-debug.apk’
The device might have stale dexed jars that don’t match the current version (dexopt error).

Let’s start with the solution:

Put < in androidmanifest.xml; application> Set the Android: vmsafemode property of to true

Since minsdkversion 21 is set, Android 5.0 (API level 21) and later versions use the runtime named art, which itself supports loading multiple DEX files from APK files. Art performs precompiling during application installation, which scans for  classesN.dex   Files and compile them into a single file  .oat   File for Android devices to execute. So if your  minSdkVersion   For version 21 or later, multidex is enabled by default, and you do not need the multidex library.

Manifest merger failed with multiple errors, see logs

This problem is commonly encountered in Android Development:

Manifest merger failed with multiple errors, see logs

Generally, there is an error in merging resources in manifest. At this time, enter the following command on the Android studio command console:

gradlew processDebugManifest –stacktrace

Press enter to view the error log, similar to the following prompts:

E:\WorkSpace\AndroidDemo>gradlew processDebugManifest --stacktrace

> Task :paysdk_demo:processDebugManifest FAILED
E:\WorkSpace\AndroidDemo\paysdk_demo\src\main\AndroidManifest.xml:38:13-45 Error:
        Attribute meta-data#APPLOG_SCHEME@value at AndroidManifest.xml:38:13-45 requires a placeholder substitution but no value for <APPLOG_SCHEME> is provided.
E:\WorkSpace\AndroidDemo\paysdk_demo\src\main\AndroidManifest.xml Error:
        Validation failed, exiting

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

Modify the error code at the corresponding position.