Category Archives: How to Fix

Android 9.0 APP Install Android 4.4 Error: classnotfoundexception

App on Android 9.0 can run, but the installation to version 4.4 program crashes, the error isClassNotFoundException,
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.xx.app/com.xx.view.splash.SplashActivity}: java.lang.ClassNotFoundException: Didn’t find class “com.xx.view.splash.SplashActivity” on path: DexPathList[[zip file “/data/app/com.xx.app-1.apk”],nativeLibraryDirectories=[/data/app-lib/com.xx.app-1, /vendor/lib, /system/lib]]
Stack.
E/AndroidRuntime( 9741):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
E/AndroidRuntime( 9741):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime( 9741):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 9741):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 9741):     at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 9741):     at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 9741):     at android.app.ActivityThread.main(ActivityThread.java:5047)
E/AndroidRuntime( 9741):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 9741):     at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 9741):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
E/AndroidRuntime( 9741):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:658)
E/AndroidRuntime( 9741):     at dalvik.system.NativeStart.main(Native Method)

Solution:
Change the version of androidx.constraintlayout:constraintlayout from 2.0.4 to 2.1.1, the problem is solved

Docker starts MySQL container and reports an error driver failed programming external connectivity on endpoint mysq

Look at the error first:

The mistake is like the above. At first, I thought my command was wrong or something else, but later I found it was not

But it’s still troubleshooting one by one.
first, the command to create a MySQL container:
docker create – P 3306:3306 — name of the container – e mysql_ ROOT_ Password = database password MySQL version:

After creation, enter the command: docker PS – a
to view all containers

Then you can see the MySQL you just named

Start command:
docker start container ID

Then an error will be reported. If an error is reported, please see the following:

Problem solving:

The first is to restart the docker. It is useless for me to restart anyway. The restart command:
systemctl restart docker
it is also possible that you will be OK after restarting

The second is to view all containers through the docker PS – a command. If you have created MySQL before, when you create a MySQL container again, you need to change an external port, not 3306. Ensure that the port and name are different from the MySQL container created before

You can also use the previous MySQL container and start it directly through the docker start container ID

Idea2021 reports an error. Default operand size is 64 sets the startup task to automatically add the registry

Problem background:

Idea with git will remind you of the following error
arbitrary: use of Rex. W is meaningless (default operand size is 64)
because there is security software, you need to add a key in the registry
Computer \ HKEY_ LOCAL_ Create a new [string value] HookApi under machine \ software \ Tec \ ocular. 3 \ agent \ config_ Dis INS, numerical data: 1
but it’s too troublesome to manually add and restart idea every time. Now it’s changed to automatically add registry configuration after startup

1. Find a directory and create two files, one regidea.bat and one regidea.log

As shown in Figure

2. Modify the bat file and enter the following instructions

(reg query HKEY_LOCAL_MACHINE\SOFTWARE\TEC\Ocular.3\agent\config /v hookapi_disins && (echo %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2% reg exist... >>%~dp0\regIdea.log )) || ((reg add HKEY_LOCAL_MACHINE\SOFTWARE\TEC\Ocular.3\agent\config  /t REG_SZ /v hookapi_disins /d 1)&&(echo %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2% reg set suc... >>%~dp0\regIdea.log ))

The main idea is to query whether there is a hook API in the registry_ Dis INS, set and print a line of text set suc… In regidea.log
If yes, print reg exist…
log file just to see if the instruction takes effect

3. Create a shortcut to the bat file and drag it into the following directory

C: \ users \ XXX \ appdata \ roaming \ Microsoft \ windows \ start menu \ programs \ startup
where XXX is the user name
if the directory cannot be found, check the view hidden item of the folder

[screen recording] an error is reported in the screenrecord command: inaccessible or not found

[question]:

~ $ adb shell screenrecord /sdcard/test.mp4

/system/bin/sh: screenrecord: inaccessible or not found

This is because many mobile phones recycle the screenrecord function for safety, so we can’t use the command line for screen recording.

Through the ADB shell LS/system/bin/command, you can see LS:/system/bin// screenrecord: permission denied, indicating that you really don’t have screen recording permission.

Another easy-to-use screen recording method

Installation (MAC OS only):

brew install scrcpy

If there is no ADB, you need to install it first:

brew cask install android-platform-tools

Run scrcpy

After installation, connect the computer to the mobile phone and execute scrcpy to see the real-time projection of the mobile phone on the computer:

scrcpy

Recording screen

If you want to record the screen, execute one of the following two commands:

scrcpy --record test.mp4
scrcpy -r test.mp4

You can also record the screen without turning on the real-time image display:

scrcpy --no-display --record file.mp4
scrcpy -Nr file.mkv

more

For more details, see scrcpy (Chinese version – & gt; scrcpy)

An error is reported when executing MVN. The diamond operator is not supported in source-1.5

Specify the version of Maven and the JDK version used by Maven

Modify in pom.xml

<project xmlns="...">
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    ...
</project>

An error is reported when passing data pages using Ajax: Vue is not defined

1、 Resolution:

Literal meaning: Vue is not defined, that is, the introduction of Vue source code;

2、 Try to resolve:

1: Try 1: check whether the Vue source code import (path and script tag) is wrong
2: try 2: there is no problem with the import syntax, that is, check whether there is a Vue source code file in the target folder, and find no (reason: I added the Vue source code file manually later, but it was not generated in time in the target)

3、 Solution steps:

Click clean to clean and regenerate the target file. The Vue source code is successfully introduced and the error is resolved;

Screenshot:

Solve the problem of docker error: Unsupported compose file version: 3.2

The following error occurred when using docker to deploy the project today:

unsupported Compose file version: 3.2

It seems that there is a version problem by searching the data:
https://stackoverflow.com/questions/58007968/unsupported-compose-file-version-x-x

Solution:
upgrade the docker and docker compose versions to the latest versions.

When using freemaker template to get values, an error is reported when the attribute is empty

When the expression ${(user. Name)! “} in freemaker is empty, an error is reported directly

FreeMarker is a template engine written in Java language. It generates text output based on the template and uses FreeMarker to judge whether the object is empty.

    general data is judged at the back end, and the front end only displays it regardless of logic. Freemaker displays that an object uses ${name}.
    but if the name is null, freemaker will report an error. If you need to judge whether the object is empty: & lt; #if name?& gt;… & lt;/#if & gt;. You can also set the default value ${name! “”} To avoid the error that the object is empty. If the name is empty, it will be displayed with the default value (the character after “!”). The object user and name are the attributes of user. At this time, both user and name may be empty, which can be written as ${(user. Name)! “”}, indicating that user or name is null, which will be displayed as empty.

     

An error occurs when HBase uses the shell command: pleaseholdexception: Master is initializing solution

Article catalog

Project scenario: Problem Description: Cause Analysis: solution:


Project scenario:

Ubuntu20.04Hadoop3.2.2Hbase2.2.2


Problem Description:

The main errors are as follows: error: org.apache.hadoop.hbase.pleaseholdexception: Master is initializing

After starting the HBase shell, when using create, list and other commands, the following error messages appear:

hbase(main):001:0> list
TABLE 
                                                                                                                    
ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
        at org.apache.hadoop.hbase.master.HMaster.checkInitialized(HMaster.java:2452)
        at org.apache.hadoop.hbase.master.MasterRpcServices.getTableNames(MasterRpcServices.java:915)
        at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java:58517)
        at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2339)
        at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:123)
        at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:188)
        at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:168)

For usage try 'help "list"'

Took 10.297 seconds

Cause analysis:

Here, my computer is only configured with HBase application for Hadoop pseudo distributed cluster, so I don’t think it’s possible that the time of HBase and zookeeper servers is inconsistent, as others on the Internet say. The main reason should be: the processes of Hadoop and HBase are inconsistent, resulting in the initialization of the master node all the time


Solution:

Format the HBase file system in Hadoop, restart HBase, and resynchronize the two:

Shut down all HBase services first:

cd /usr/local/hbase
bin/stop-hbase.sh

Then close all Hadoop services:

cd /usr/local/hadoop
sbin/stop-all.sh

Enter JPS to ensure that all Hadoop and HBase processes are closed:

zq@fzqs-Laptop:~$ jps
4673 Jps

Then start the Hadoop service:

cd /usr/local/hadoop
sbin/start-all.sh

To view files in HDFS:

bin/hdfs dfs -ls /

The output shall be as follows (including/HBase):

zq@fzqs-Laptop:/usr/local/hadoop$ bin/hdfs dfs -ls /
Found 1 items
drwxr-xr-x		- root supergroup 		0 2021-10-28 21:49 /hbase

Delete/HBase Directory:

bin/hdfs dfs -rm -r /hbase

Start HBase service:

cd /usr/local/hbase
bin/start-hbase.sh

Then start the shell and you should be able to use it:

bin/hbase shell

Resolve the error raise importerror, str (MSG) + ‘, please install the python TK package’ (valid for personal testing)

Solve the following similar error reports:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
    raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: /usr/lib/libtk8.5.so.0: invalid ELF header, please install the python-tk package

terms of settlement:

It appears that the library is corrupted
try sudo apt get remove Python TK ,
then sudo apt get clean download the package again,
sudo apt get install Python TK and then try importing again
this problem is resolved.

Another possibility is that you somehow messed up your apt/sources. List, and you installed a library for the wrong platform.

Reference link:
https://stackoverflow.com/questions/11043844/python-tk-package-not-recognized-in-python-2-7-3

Solve the runtimeerror in RNN: expected scalar type long but found float error

Project scenario:

Today, I saw the code of an RNN instance. I want to try to pass in RNN with my own data, but I can report an error.

Problem Description:

The error is runtimeerror: expected scalar type long but found float


Cause analysis:

The wrong input is as follows:

input=torch.tensor([ 0,  0,  0,  0,  0,  0,  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
         0,  0,  0,  0,  0,  0])

The input in the example is as follows:

input=torch.tensor([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0.]])

The reason is that I set dtype = torch.long when generating input


Solution:

Input = torch. Tensor (input, dtype = torch. Float)
specify dtype = torch. Float when generating the input tensor, and the resulting input will be of the following types

input=torch.tensor([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0.]])

If it meets the requirements, no error will be reported
I didn’t expect to solve this problem. I spent most of the night. I really haven’t started yet. I don’t have enough skills.

Opencv453 drawing rectangle function error reporting solution

# draw gt
cv2.rectangle(img, (gt[0], gt[1]), (gt[2], gt[3]), (0,255,0), 1)

The following error occurred while running:

The rectangle function in opencv453 is incompatible with floating-point data  

terms of settlement:

It is OK to convert the two coordinate data types in the rectangle function to int

cv2.rectangle(img, (int(gt[0]), int(gt[1])), (int(gt[2]), int(gt[3])),(0,255,0), 1)