Tag Archives: Android

Flutter flutter doctor –android-licenses [How to Solve]

Error message

Solution:

In androidstuido, file – > Setting-> Appearance-> System Setting-> Check whether it is installed under the Android SDK (as shown in the figure)

if not, directly click Android stuido to download
and then run the shuttle doctor — Android licenses to select y in the whole process

result

Execute the flitter doctor to check all √ to prove that it has been arranged

Flutter Error: dump failed because resource AndroidManifest.xml not found [How to Solve]

I encountered this problem yesterday. First of all, I went online to inquire about these three solutions

1: Use the command fluent clean (some users report errors and solve them)

2 manually delete all files in the build/APP/APK and build/APP/outputs directories

3. There is also the official command to use fluent create

These three solutions failed to solve my error reporting. Then I suddenly had an idea that my outermost folder was a Chinese name. Sure enough, I solved the error reporting after I changed the Chinese name to the English name. I hope all developers will not encounter such a bug

Unity Android solves the problem of information flow advertisement closing and error reporting

This error often occurs when unity connects to some native andorid SDKs:

W/system. Err: Android. View. Viewrootimpl $calledfromwrongthreadexception: only the original thread that created a view hierarchy can touch its views.
the solution is to use runonuithread() in the java file written by the Android layer

The reason is that the UI update of Android needs to be in the main UI thread, and some callbacks of the advertising SDK are not in this thread

reference material:

https://www.jianshu.com/p/866743c0356b

https://blog.csdn.net/cf8833/article/details/90297775

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

[Solved] Android Error: AAPT: error: unescaped apostrophe in string;Multiple substitutions specified in non-positi

I. AAPT: error: unescaped apostrophe in string </ font>

Cause analysis of error reporting

When doing the internationalization multilingual function, I defined some strings in the arrays.xml file as follows

<item>My name's Lisa</item>

The error report is translated as the apostrophe
that is not replaced by the string. Therefore, I thought that the error report may be caused by ', so I replaced the above code with the following code to solve the error report.

<item>My name&quot;s Lisa</item>

Error reporting solution

apostrophe ' available & amp; quot; replacement, such as: <item> My name& quot; s Lisa you can use double quotation marks to enclose string resources, such as: <item>" My name's Lisa" escape characters can be used before apostrophe ', such as: <item> My name\'s Lisa

II. Multiple substitutions specified in non positive format

Cause analysis of error reporting

First, I defined some strings in the string. XML file

<string name = "upgrade_time"> Driver board: %s\t\t signal version.%s</string>

Error reporting translates to multiple substitutions specified in a non location format. The error reporting prompt mentions setting formatted = "false" , so I change the above code to the following one, so I won’t run error reporting.

<string name = "upgrade_time" formatted="false"> Driver board: %s\t\t signal version.%s</string>

Error resolution
After reviewing some blog posts and trying it out myself, there are these ways to fix the above error.
Add formatted="false" attribute in the string with %% to indicate a %
Third, some common HTML special character encoding
In the Android xml file, involving some special characters may be reported in the display of the error, you need to use HTML special characters to convert.

Special symbols HTML encoding
& &amp;
> &gt;
< &lt;
> &gt;
&quot;
> &gt;
Half a blank space ensp;
A blank space &emsp;
> &gt;

FIX: SSL error when connecting to the Jack server. [How to Solve]

FIX: SSL error when connecting to the Jack server.
##Background
unbuntu16.04 compiles android 8 source code and suddenly reports an error.

FAILED: setup-jack-server 
/bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar  2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )"
Jack server already installed in ".jack-server"
Communication error with Jack server (35), try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'

Solution

Try according to the prompt:

$ jack-diagnose
error: process ID list syntax error

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
Port 8077 is used by another process (pid=), please ensure to free the port or change port configuration in '/.jack-settings' and 'jack-server/config.properties'
error: process ID list syntax error

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
Port 8076 is used by another process (pid=), please ensure to free the port or change port configuration in '.jack-settings' and '/.jack-server/config.properties'
SSL error when connecting to the Jack server. Try 'jack-diagnose'

The problem remains the same, so the focus is still on SSL communication:
finally, it is solved by the following methods:

1. Edit/etc/java-8-openjdk/security/java.security 
#
# Algorithm restrictions for Secure Socket Layer/Transport Layer Security
# (SSL/TLS) processing
#
# In some environments, certain algorithms or key lengths may be undesirable
# when using SSL/TLS.  This section describes the mechanism for disabling
# algorithms during SSL/TLS security parameters negotiation, including
# protocol version negotiation, cipher suites selection, peer authentication
# and key exchange mechanisms.
#
# Disabled algorithms will not be negotiated for SSL/TLS connections, even
# if they are enabled explicitly in an application.
#
# For PKI-based peer authentication and key exchange mechanisms, this list
# of disabled algorithms will also be checked during certification path
# building and validation, including algorithms used in certificates, as
# well as revocation information such as CRLs and signed OCSP Responses.
# This is in addition to the jdk.certpath.disabledAlgorithms property above.
#
# See the specification of "jdk.certpath.disabledAlgorithms" for the
# syntax of the disabled algorithm string.
#
# Note: The algorithm restrictions do not apply to trust anchors or
# self-signed certificates.
#
# Note: This property is currently used by the JDK Reference implementation.
# It is not guaranteed to be examined and used by other implementations.
#
# Example:
#   jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves




2. Find the line of TLSv1, delete TLSv1, TLSv1.1, and save it.

3. switch to the Android compiled source project directory: prebuilts/sdk/tools/

4. Run.

./jack-admin kill-server 

./jack-admin start-server

[Solved] Android Could not determine artifacts for XXXX: Skipped due to earlier error

Recently, I encountered the following problems when using robolectric unit test:

It has been reported that the resource class cannot be found, so it needs to be added to gradle under the app (the code is manually typed, there may be an error, sorry)

testOptions{
	unitTests{
			includeAndroidResources = true
	}
}

After adding the above code, there is an error in the title, specifically android.test.monitor2… This can’t be found. Each time sync takes a long time, and then report the same error. Refer to the following link article, but it doesn’t help me much.

Ask colleagues for help. After comparing our configurations, we found that the gradle version references are different (gradle/wrapper/gradle wrapper. Properties). The previous references are:

distributionUrl:=https\://service.gradle.org/distributions/gradle-5.4.1-all.zip

Mine is taken directly from the company mapping Maven library. It is a local reference with a lower version:

distributionUrl:=../../../../tools/gradle-4.1-all.zip

I changed the gradle configuration according to her configuration and synced again. The problem was solved.

Android Compile Error: “SSL error when connecting to the Jack server. Try ‘jack-diagnose‘”

The code compilation of 8909 A7 has never been a problem before. Suddenly, one day, the compilation encountered SSL-related errors. The specific errors are as follows:

[  0% 12/6140] Ensure Jack server is installed and started
FAILED: /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar  2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 4.8.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-3.36.CANDIDATE.jar 3.36.CANDIDATE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.7.BETA.jar 4.7.BETA || exit 47 )"
Jack server already installed in "/fwork1/yuwl/.jack-server"
Communication error with Jack server (35), try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'
[  0% 12/6140] target R.java/Manifest.java: SnapdragonCamera (out/target/common/obj/APPS/SnapdragonCamera_intermediates/src/R.stamp)

Judging from the error log, it was an SSL exception when connecting to the jack server. At first, it was considered to be a jack server problem. The processing process included restarting the jack server service and configuring the jack server port number. It was ineffective. Finally, it was found that many people encountered the same problem through the network. The solutions are as follows. The personal test is effective

Solution:
delete the tlsv1 and tlsv1.1 configurations of the jdk.tls.disabledalgorithms parameter in the/etc/java-8-openjdk/security/java.security file

NDK Version Clang++: error: unknown argument: ‘-static-openmp‘

Cmakelists.txt file compiles ncnn and CPP and runs normally on the other two Ubuntu machines.

Similarly, the source code is configured, the project is loaded, and the gradle initialization is correct, but there is an error in compiling APK.

clang++: error: unknown argument: ‘-static-openmp’

After searching for a long time, I can’t see the wrong configuration. I doubt the gradle version. The problem remains after the upgrade; Upgrade the as version, and the problem still occurs.

Open settings, SDK configuration, check SDK tools, and reinstall SDK. The latest SDK 23.0 is installed at once. The error disappears, but there is still a problem with the compilation. It is reduced to SDK 20.0, and the error occurs again.

High or low, choose ndk21.3 and cmake3.10.2. Finally, the compilation is normal and the debugging is passed.

Error:No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android

Introduce a project and prompt this error after configuring the NDK

the reason for this error is that mipsel Linux Android is officially not recommended, so gradle is not supported, but it will cause the compilation of the old version to fail.

Open project structure , view the path of NDK under SDK loading , open the path in the folder
enter the toolchains folder to view, and there are no error files

Method 1 (invalid)

This method is invalid because there is no mipsel in the new version of NDK
the official download requires the version of NDK, then unzip it, find the mipsel Linux Android folder under the toolchains folder under the NDK directory, and put it into the toolchains folder of the local NDK

Method 2 (redirect directory)

Windows executes the following under the toolchains directory, provided that arm linux android-4.9 is an existing directory under toolchains

mklink /j  mipsel-linux-android arm-linux-androideabi-4.9

Execute under Linux

 ln -sf arm-linux-androideabi-4.9 mipsel-linux-android

After execution, the link is established successfully.

An error is reported after rebuild no toolchains found in the NDK toolchains folder for ABI with prefix: mips64el Linux Android , continue to perform the above operations, and associate mips64el Linux Android with aarch64 Linux android-4.9

Method 3 (upgrade gradle)

Upgrade the gradle version to 3.1.3 or above without testing. It can also be solved by checking that someone passes this method

Error: expected caller to ensure valid ABI: MIPS

After solving the above problem sync, continue to report errors:

Error:Expected caller to ensure valid ABI: MIPS

Solution (Reference): add in defaultconfig in app/build.gradle

ndk {
    abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}