Tag Archives: Error Record

[error record] as compilation error (Android support plugin version is too high | upgrade Android studio to the latest version)

Contents of articles

1、 2. Solutions

1、 Error information


Clone a piece of code from GitHub. The following error occurs when compiling;

Download https://services.gradle.org/distributions/gradle-6.7.1-bin.zip (102.84 MB)
Download https://services.gradle.org/distributions/gradle-6.7.1-bin.zip finished succeeded, took 1 m 55 s 666 ms
Starting Gradle Daemon...
Gradle Daemon started in 4 s 99 ms
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
AGPBI: {"kind":"warning","text":"Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.\nThis repository is deprecated and it will be shut down in the future.\nSee http://developer.android.com/r/tools/jcenter-end-of-service for more information.\nCurrently detected usages in: root project 'Plugin_Hook', project ':app'","sources":[{}]}

FAILURE: Build failed with an exception.

* What went wrong:
This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException: This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer.
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:273)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:131)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:56)
	at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:79)
	at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner$ActionRunningListener.runAction(ClientProvidedPhasedActionRunner.java:120)
	at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner$ActionRunningListener.run(ClientProvidedPhasedActionRunner.java:110)
	at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner$ActionRunningListener.buildFinished(ClientProvidedPhasedActionRunner.java:104)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.lang.Thread.run(Thread.java:748)



* Get more help at https://help.gradle.org

BUILD FAILED in 8m 33s

2、 Solutions


Core error information:

This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer.

The current Android support plug-in can’t open the project. Upgrade Android studio to

four point two

four point two

Version 4.2 or above;

[error record] kotlin code compilation error when Android studio compiles (process @ nonnull parameter when upgrading support library)

Contents of articles

1、 Error information 2. Error analysis 3. Solutions

1、 Error information


Recently, we have upgraded all the support libraries to

28.0.0

28.0.0

28.0.0 ;

implementation 'com.android.support:recyclerview-v7:28.0.0'

There are a lot of errors in the support library code of kotlin language;

2、 Error analysis


Here, we inherit the recyclerview.itemdecision class and override the getitemoffsets method,

object : RecyclerView.ItemDecoration() {
                    override fun getItemOffsets(outRect: Rect?, view: View?, parent: RecyclerView?, state: RecyclerView.State?) {
                        super.getItemOffsets(outRect, view, parent, state)
}

Note that in the overridden method, the parameter type

outRect: Rect?view: View?parent: RecyclerView?state: RecyclerView.State?

All are nullable types;

Look at the real code of itemdeclaration. The four parameters of getitemoffsets method are all non empty types, and the @ nonnull annotation is added. Therefore, non empty parameters must be passed in here. When inheriting, they are nullable parameters. An error will be reported, and the parameter types are inconsistent;

        public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
            this.getItemOffsets(outRect, ((RecyclerView.LayoutParams)view.getLayoutParams()).getViewLayoutPosition(), parent);
        }

Item decision complete code reference:

    public abstract static class ItemDecoration {
        public ItemDecoration() {
        }

        public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
            this.onDraw(c, parent);
        }

        /** @deprecated */
        @Deprecated
        public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent) {
        }

        public void onDrawOver(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
            this.onDrawOver(c, parent);
        }

        /** @deprecated */
        @Deprecated
        public void onDrawOver(@NonNull Canvas c, @NonNull RecyclerView parent) {
        }

        /** @deprecated */
        @Deprecated
        public void getItemOffsets(@NonNull Rect outRect, int itemPosition, @NonNull RecyclerView parent) {
            outRect.set(0, 0, 0, 0);
        }

        public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
            this.getItemOffsets(outRect, ((RecyclerView.LayoutParams)view.getLayoutParams()).getViewLayoutPosition(), parent);
        }
    }

3、 Solutions


Google did not add the @ nonnull annotation to the parameters of the support library method before. In the

28.0.0

28.0.0

In version 28.0.0, the annotation is added, which leads to the incompatibility of inheritance;

The modification method is to set all parameter types to non empty type and delete the question mark in each parameter;

[error record] invalid gradle JDK configuration found

Contents of articles

1、 2. Solutions

1、 Error information


Android studio compile time prompt

Invalid Gradle JDK configuration found

Mistakes;

2、 Solutions


Right click the project root directory in the project panel and select the “open module settings” option,

In the “SDK location” panel of the “project structure” dialog box, switch the setting of “JDK location”;

There are two options to set, one is the default JDK path of the system, and the other is the default JDK path of Android studio. Just switch it;

[error record] Android App packaging error (entry name ‘assets / xxx. XML’ merged)

Contents of articles

1、 2. Solutions

1、 Error information


When packaging and compiling Android applications, the following error is reported:;

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > Entry name 'assets/xxx.xml' collided

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 26s
51 actionable tasks: 5 executed, 46 up-to-date

2、 Solutions


The reason for the above error is that there is already a file in the target path to generate APK. Just delete the APK installation package generated last time;

[error record] Android application release package error handling (turn off syntax check log processing release configuration)

1. Turn off grammar checking


 

When Android applications are packaged, there will be a series of syntax checks, such as the placement of a layout file, which is cumbersome;

In build. Gradle under the module, configure as follows: check the syntax and ignore some minor syntax errors;

android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

 

 

 

 

2. Log processing

According to the compilation type buildconfig.debug in the current compilation configuration, select whether to print the log;

public final class BuildConfig {
  public static final boolean DEBUG = Boolean.parseBoolean("true");
  public static final String APPLICATION_ID = "cn.zkhw.midi";
  public static final String BUILD_TYPE = "debug";
  public static final int VERSION_CODE = 1;
  public static final String VERSION_NAME = "0.1";
}

If the current version is release, the value of buildconfig.debug is false;

 

Example of development log tool class log:

public class L {

    public static void i(String TAG, String msg) {
        if (BuildConfig.DEBUG)
            Log.i(TAG, msg);
    }
}

 

3. Release compiler optimization configuration

In general, the release release version needs the following configuration;

android {
    buildTypes {
        debug {
        }

        release {
            zipAlignEnabled true     
            shrinkResources true    
            minifyEnabled true      
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

[error record] the tinker hot fix example runs with an error (patch receive fail: / storage / simulated / 0 / patch)_ signed_ 7zip.apk, code: -2)

Contents of articles

1、 2. Solutions

Refer to [Android hotfix] to run Tinker’s official example blog;

1、 Error information


In Tinker hotfix, the generated patch package app debug patch_ signed_ 7zip.apk to the root directory,

The following error occurred when trying to hot repair;

2021-04-23 22:52:50.533 22855-22855/tinker.sample.android V/Tinker.SamplePatchListener: receive a patch file: /storage/emulated/0/patch_signed_7zip.apk, file size:0
2021-04-23 22:52:50.536 22855-22855/tinker.sample.android I/Tinker.DefaultLoadReporter: patch loadReporter onLoadPatchListenerReceiveFail: patch receive fail: /storage/emulated/0/patch_signed_7zip.apk, code: -2

2、 Solutions


Pay attention to the patch package loading path, and tinker will automatically load the patch in the root directory_ signed_ 7zip.apk file;

receive a patch file: /storage/emulated/0/patch_signed_7zip.apk, file size:0

Run the tinkerpatchdebug gradle task, and the generated patch package name is app debug patch_ signed_ 7zip.apk ,

Blind lead, wasted dozens of minutes, looking for errors;

Add the app debug patch_ signed_ 7zip.apk renamed patch_ signed_ 7zip.apk, and then copy it to the root directory of mobile phone SD card;

Typeerror: ‘module’ object is not callable

This error means that the module is called as a function, but it itself cannot be called.
The problem arises because of the import mechanism.
There are two ways to import modules into Python: Import Module and From Module Import. The difference is that the former requires the module name to be used, while the latter does not.
Try again using the following import mode, with high probability, the problem will be solved.

from module import *

reference

    on the road, WWBhuzhenwei Sprite Fsky

.
.
2019-03-19 12:57:15 written in Shanghai

(20200915 solved) vscope appears unable to open ‘hashable’_ class_ helper.pxi ‘

  • problem description

    Unable to open ‘hashtable_class_helper. Pxi’ : Unable to read file ‘vscode – remote:// SSH remote + data1/home/data/anaconda3/lib/python3.7/site – packages/pandas/_libs/hashtable_class_helper pxi’ (the Error: Unable to resolve non – existing file ‘vscode – remote:// SSH remote + data1/home/data/anaconda3/lib/python3.7/site – packages/pandas/_libs/hashtable_class_helper pxi’).
    Blockquote>

  • solution

    occurs when using vscode.

    is usually caused by index problems.

    for example, null dataframe, select data from null df, etc.