Tag Archives: IDE

JZVideo Error: Attempt to invoke virtual method ‘android.view.Window android.app.Activity.getWindow()’ on a null object reference

1. Error reporting

Attempt to invoke virtual method ‘android.view.Window android.app.Activity.getWindow()’ on a null object reference

2. Cause

VideoAdapter.java file code:

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.item_mainlv,parent,false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }

        // Get the data source of the specified location
        String path = "xxxx";
        holder.jzvdStd.setUp(path,"test",JzvdStd.SCREEN_NORMAL);

        holder.jzvdStd.positionInList = position;

        return convertView;
    }

    class ViewHolder{
        JzvdStd jzvdStd;
        public ViewHolder(View view){
            jzvdStd = view.findViewById(R.id.item_main_jzvd);
        }
    }

Since jzvdStd has released the jzvdStd window when the full screen is cut to a small screen, and the subsequent if (convertView == null) judgment, directly to the else statement, so the window that has been released cannot be obtained by the statement in the else in the window, so the error is reported. (The above is a personal opinion)

3. Solution

Replace the above code with the following code

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder;
        if (null == convertView) {
            viewHolder = new ViewHolder();
            LayoutInflater mInflater = LayoutInflater.from(context);
            convertView = mInflater.inflate(R.layout.item_mainlv, null);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.jzvdStd = convertView.findViewById(R.id.item_main_jzvd);


        // Get the data source of the specified location
        String path = "xxx";
        viewHolder.jzvdStd.setUp(path,"test",JzvdStd.SCREEN_NORMAL);

        return convertView;
    }

    class ViewHolder{
        JzvdStd jzvdStd;
    }

How to Solve Visual Studio C4996 Error

Follow the path VisualStudio\Common7\IDE\VC to find the folder VCProjectItems:

Right click to grant access permission -> Specific user

Click “share”

Enter the folder VCProjectsItems and open the file newc++file.cpp with Notepad. Paste the following into the file and save:

#define _CRT_SECURE_NO_WARNINGS 1

Right-click the folder VCProjectItems and click Properties -> Share -> Advanced sharing, click “share this folder” to uncheck it, and click “apply” and “OK”.

This will solve the problem. Create a new C/C + + file in vs. you can see the following code on the first line:

#define _CRT_SECURE_NO_WARNINGS 1

​​​​​​​

In this way, no error will be reported when using functions such as scanf(), printf().

[Solved] open failed: ENOENT (No such file or directory)

open failed: ENOENT (No such file or directory)

1. Error description

The following error occurred while writing the file to sdcard:

open failed: ENOENT (No such file or directory)

2. Error analysis

At first, I thought I forgot to add read-write permission, which was checked.

Finally, when I think of android10 onwards, in addition to the dynamic application of permissions, you must add in the Application node of AndroidManifest.xml of the main application.

android:requestLegacyExternalStorage="true"

3. Solution

Add the following codes in the Application node of AndroidManifest.xml of the main application:

android:requestLegacyExternalStorage="true"

 

[Solved] Installation failed due to: ‘INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: Package com.

1. No system signature is added

If you have not added the system signature, find the following codes at the header of the AndroidManifest.xml file and delete it:

android:sharedUserId="android.uid.system"

2. Added system signature

  1. Check whether there is any problem with the system signature itself or the joining method?
  2. If there is no problem with the system signature, there should already be an APK in the system, and the current APK should be added to the system uid. At this time, you should first delete the APK that exists in the system, and then reboot.
adb root
adb uninstall com.xxx.xxxx
adb reboot

[Solved] tsc execute error in VSCode Terminal

Premise: node and typescript are installed

Error: execute TSC xxx.ts in vscode, an error will be reported.

Solution: the execution mechanism of vscode is limited. Just change the execution mechanism

Exit vscode and run as administrator.
step 1:
execute get-ExecutionPolicy and return Restricted, which means it is restricted.
step 2:
execute  set-ExecutionPolicy RemoteSigned
step 3:
execute get-ExecutionPolicy and return RemoteSigned

Perform the above steps and execute TSC xxx.ts again is OK

 

Python3.7 Capture exception error: Too broad exception clause

In Pycharm, using try…exception will result in the Too broad exception clause… warning

The reason for this error is that the exceptions caught in the past are generalized and not to specific exceptions, which lack relevance and can be solved by specifying the exact exception type.
such as:

Baseexception: the base class of all exceptions
systemexit: the interpreter requests to exit
keyboardinterrupt: the user interrupts execution (usually input ^c)

error: base class of general error
stopiteration: the iterator has no more values
generatorexit: the generator has an exception to notify the exit
standarderror: base class of all built-in standard exceptions
arithmeticerror: base class of all numerical calculation errors
floatingpointerror: floating-point calculation error
overflowerror: numerical operation exceeds the maximum limit
zerodivisionerror: division (or modulo) Zero (all data types)
assertionerror: assertion statement failure
attributeerror: the object does not have this attribute
eofilter: there is no built-in input, Reaching EOF tag
environmenterror: base class of operating system error
ioerror: input/output operation failure
oserror: operating system error
windowserror: system call failure
importerror: import module/object failure
lookuperror: base class of invalid data query
indexerror: this index is not in the sequence
keyerror: this key is not in the mapping
memoryerror: memory overflow error (not fatal for Python interpreter)
nameerror: undeclared/initialized object (no attributes)
unboundlocalerror: accessing uninitialized local variables
referenceerror: weak reference Trying to access an object that has been garbage collected
runtimeerror: general runtime error
notimplementederror: unimplemented method
syntaxerror: Python syntax error
indentationerror: indentation error
taberror: mixed use of tab and space
systemerror: general interpreter system error
typeerror: invalid operation on type
valueerror: passing in invalid parameters
Unicode error: Unicode related Error of
Unicode decodeerror: error in Unicode decoding
Unicode encodeerror: error in Unicode encoding
Unicode translateerror: error in Unicode conversion
warning: base class of warning
deprecationwarning: warning about deprecated features
futurewarning: warning about future semantic changes in construction
overflowwarning: old warning about automatic promotion to long integer (long) Warning of
pendingdeprecationwarning: warning about feature will be discarded
runtimewarning: warning about suspicious runtime behavior
syntaxwarning: warning about suspicious syntax
userwarning: warning generated by user code

If you are not sure about the possible errors, or you need to use exception and pycharm is not allowed to complain, how should you solve it
Method 1: turn off the option to detect exceptions in code detection in the compiler
Method 2: add # noinspection PyBroadException before the try statement

# noinspection PyBroadException
try:
       pass
except Exception as e:
       pass

[Solved] PyCharm pytest-html Install Error: Try to run this command from the system terminal. Make sure that you use

PyCharm pytest-html Install Error: Try to run this command from the system terminal. Make sure that you use

Exception prompt:
try to run this command from the system terminal Make sure that you use the correct version of ‘pip’ installed for your Python interpreter located at ‘E:\python\Program\Scripts\python.exe’.

Solution:
Switch the pycharm interpreter and reconfigure it again.

Eclipse start project error: Errors occurred during the build. Errors running builder ‘Integrated External Tool Builder’ on…

When eclipse starts the project, it suddenly reports: Errors occurred during the build. Errors running builder ‘Integrated External Tool Builder’ on project ‘acc-bid’. The builder launch configuration could not be found. The builder launch configuration could not be found.

The project kept building when it started, so I unchecked the validation box, which resulted in the above error

And when you look at buliders again, you bring a red cross

If you remove the fork, you won’t report an error