Tag Archives: Android

[Solved] error: method does not override or implement a method from a supertype

Compilation error:

error: method does not override or implement a method from a supertype

@Override

error: TestDocumentClipper is not abstract and does not override abstract method copyFromClipboard(DocumentInfo,DocumentStack,Callback,Injector) in DocumentClipper

The above is the compilation error caused by increasing or decreasing the parameters in the method when overriding the method of the parent class in a subclass, or when implementing the interface and overriding the method of the interface in a class
the above error messages are translated as:

1. Method does not override or implement the method in the supertype
2. Testdocumentclipper is not abstract and does not override the abstract method copyfromclipboard (documentinfo, documentstack, callback, injector) in documentclipper

Analysis:
when the documentclipper class implements the methods of the documentclipper interface, it adds (reduces) one more parameter, but there is no corresponding method in the interface to match, so it leads to compilation errors.

Solution:
Add (reduce) the same parameter to the corresponding method in the interface (parent class).

For example, you override the copyfromclipboard() method of the documentclipper interface in the documentclipper class. Because of necessity or carelessness, you add the parameter injector of type injector. The code is as follows:

@Override
public void copyFromClipboard(
        DocumentInfo destination,
        DocumentStack docStack,
        FileOperations.Callback callback,Injector injector){……

At this time, you need to find the copyfromclipboard() method in the documentclipper interface and add the same type of parameters

void copyFromClipboard(
            DocumentInfo destination,
            DocumentStack docStack,
            FileOperations.Callback callback,Injector injector);

[Solved] Android x relies on AAR errors: Failed to transform…

Problem
Updating Android Studio and using androidx to generate arr, on which the application depends, results in many errors, as follows.

Failed to transform xxxx-.aar (:xxxx:) to match attributes {artifactType=jar, org.gradle.status=integration}
Failed to transform file ‘some-lib-release.aar‘ to match attributes {artifactType=processed-aar} usi

Solution:
Modify the configuration in gradle.properties.

android.enableJetifier=false

Android uses the Android iconics font library error [How to Solve]

Today, after using the font library on GitHub, it is found that the control has not been recognized after the successful introduction:

Android-Iconics

introduce:

//Font library
implementation 'com.mikepenz:iconics-core:5.3.0@aar'
//this adds all ui view widgets (IconicsButton, IconicsImageView, ...)
implementation 'com.mikepenz:iconics-views:5.3.0'

After trying several ways, I found that the problem is that the kotlin version of Android studio is too low

My original plug-in version is 1.3.6. After updating to 1.4.10, I successfully referenced it

Android studio reports an error when building AAR for unity

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Java\jdk1.8.0_191\bin\java.exe -classpath "C:\Program Files\Unity Hub\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.6.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class bitter.jnibridge.JNIBridge found in modules opsdk-debug-runtime.jar (:opsdk-debug:) and unity-classes.jar (unity-classes.jar)
  Duplicate class bitter.jnibridge.JNIBridge$a found in modules opsdk-debug-runtime.jar (:opsdk-debug:) and unity-classes.jar (unity-classes.jar)
  Duplicate class com.unity3d.player.GoogleARCoreApi found in modules opsdk-debug-runtime.jar (:opsdk-debug:) and unity-classes.jar (unity-classes.jar)

Error running ‘Android Debugger (-1)‘ [How to Solve]

The Android studio attach debugger suddenly fails. Read the event log and report an error

2: 10 PM can’t bind to local – 1 for debugger

2: 10 PM error running ‘Android debugger (- 1)’: unknown error

2: 10 PM error running ‘Android debugger (- 1)’
invalid argument: argument invalid
[port]

There are similar port occupancy and other errors on the Internet, but those are basically a specific port, which is directly – 1 port. At first, I wanted to change the debugger’s port in preference to use existing manually managed server, and specify a port, so I couldn’t connect directly.

After that, I thought it was because preview and the official version were installed at the same time, and then I reinstalled Android studio.

Finally, it was solved. It turned out that the host file needs to map localhost to 127.0.0.1

127.0.0.1       localhost 

error: resource android:attr/lStar not found [Pefect Solution]

Today, the following errors suddenly appear in the project, and the compilation will report an error

D:\AndroidProjects\XXXXX\app\build\intermediates\incremental\mergeDebugResources\
merged.dir\values\values.xml:10858: AAPT: error: resource android:attr/lStar not found.

No one submitted the code. I could still run yesterday, but I suddenly couldn’t do it today. Then there were all kinds of tosses. I tried the common methods for difficult and miscellaneous problems in the development process. Clean project, clear the studio cache and restart, restart the computer, etc. the problems still exist. I searched for a circle and didn’t find the corresponding solutions.

Problem:

The project or third-party library relies on androidx.core: core KTX: + , and there is no limited version. Therefore, the latest core KTX version 1.7.0 is used, and the above compilation error is reported, and it is still sudden.

 

Solution:

The specific version number depends on the project, not necessarily 1.3.2. I understand that it can be lower than 1.7.0

Method 1: project reference and directly set the specific version number. For example, my project:
implementation "Android. Core: core KTX: 1.3.2"
method 2: the version number is not set in the third-party dependency library. You can add the following code in build.gradle of APP module:
at the same level as Android {}

configurations.all {
    resolutionStrategy {
        force 'androidx.core:core-ktx:1.3.2'
    }
}

Note: the specific version number of remote dependency must be set. Never use the + end. This compilation will pull the corresponding latest remote dependency. Maybe there will be an inexplicable problem that day.

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

error: resource android:attr/lStar not found…….

After searching for a long time, there is nothing related to LSTAR under my attr directory. The project has not added LSTAR related fields from the beginning to the end, but the project inexplicably reported this error, that is, it can’t run. It can run in the first minute. Suddenly it can’t run. Do you say it’s annoying or not

To get down to business, the reason is that Android. Core: core KTX: + is referenced in the third-party library, and then the system automatically updates to version 1.6.0, resulting in an error: resource Android: attr/LSTAR not found. Change the version to Android. Core: core KTX: 1.6.0, synchronize and compile it.

[Solved] Appium Install Error: Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variab

Operating environment.
Appium-windows-1.21.0,手机vivo s7/Android 10
appium startup error: An unknown server-side error occurred while processing the command. Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more details
The general idea is that the SDK environment variables are not configured correctly and cannot be read, so you can use manual configuration.

Solution, manually select the android SDK


I thought this would be solved, I did not expect that there are new mishaps
An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: ‘Command ‘D:\Android\platform-tools\adb.exe -P 5037 -s 2591584f install -g ‘C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’’ exited with code 1’; Stderr: ‘adb: failed to install C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk: Failure [INSTALL_FAILED_ABORTED: User rejected permissions]’; Code: ‘1’

Solution: Because the Vivo phone I used did not give permission to open the developer mode to connect to debug after a one-time installation of several appium-related apk, just keep agreeing, you can enter.

error: multiple substitutions specified in non-positional format; did you mean to add the formatted

When used

 aapt2 compile -o build/res.zip --dir ./app/src/main/res

You may encounter the following problems

./app/src/main/res/values/strings.xml:4: error: multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?.
./app/src/main/res/values/strings.xml: error: file failed to compile.

You can check the strings. XML file and replace placeholders such as % s with % 1 $s