Limit the number of processes. Kill them
So the question is, which process to kill
This?
Or this one?
Kill bash. Exe
Under the CMD tasklist
Taskkill /pid 12345-t-f
12345 is the process ID of bash
Just kill it
RXJava code>, RxAndroid code>, Retrofit code> to support development response type, and refactor the code, refactoring everything but in running an Java lang. NoClassDefFoundError code> this error, and in a few test machine shows the name of the class is different also, For example, on MI4, there is no Handler, and on Huawei, there is no OKHttputils class. This is very confusing. After searching Google, we can't find the problem, but on another Samsung test machine, there is no problem, and finally we find that Multidex is the problem.
Some third party libraries were added during the refactoring, which pushed the number of methods in the entire Android application beyond 65535. The following error should occur when packaging
java.lang.IllegalArgumentException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:501)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:282)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:490)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
multiDexEnabled true
z multiDexEnabled true
defaultConfig
z multiDexEnabled true
Automatically when a method is more than 65535 hit two Dex package named classes. Dex code> classes2. Dex code>, some methods were scored the second Dex package, namely the classes2. Dex code>, resulted in 5.0 the following models can't run the error.
Here's the solution:
1. defaultConfig
code> m>dexEnabled true
is used>enable MultiDex
2. is added in the dependence on the compile 'com. Android. Support: multidex: 1.0.1' code> support package for 5.0 the following systems
3. If your project already contains the Application class, then let it inherits. Android support. Multidex. MultiDexApplication class, if your Application has inherited the other classes and do not want to do change, so there's another way of using, overwrite attachBaseContext () method:
public class MyApplication extends FooApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Some problems with Android AIDL
(1) Starting Service ** is required after 5.0
An error will be reported if the service is started implicitly (unless Intent. SetPackage (” application package name of the service to be started “) is started implicitly).
Error:(9, 41) No symbol can be found
The reason is that the other class name (Java) file is mixed with aidl’s aidl file in the same directory
Java files have to be placed under the Java file (server package name + Java file).
Error 1
Error: Error converting the bytecode to dex:
Cause: Java. Lang. RuntimeException: Exception parsing classes
Reason package names contain uppercase letters
example:
er.java
p>ge com.example.lqm;
user.java
package com.example.lqm;
public class User implements Parcelable{
private String id;
privte String name;
… .
}
The corresponding aidl file is
user.aidl
package com.example.lqm; // This is user. aidl package
parcelable User;
Aidl learning
How is data passed across processes
The two processes cannot directly
mmunicate indirectly v> code>,> underlying layer of Android system
AIDL:android interface definition language
Android interface definition language
MOOC video learning address
Data types are supported by default
Basic data types String, CharSequencelist, MAppArcelable
steps
To create a binding service using AIDL, perform the following steps:
Create.aidl file
This file defines the programming interface with method signatures.
package com.example.android;
interface IRemoteService {
int getPid();
void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
double aDouble, String aString);
}
The Android SDK tool generates an interface using the Java programming language based on your.aidl file. This interface has an internal abstract class called Stub that extends the Binder class and implements methods in the AIDL interface. You must extend the Stub class and implement the method.
private final IRemoteService.Stub mBinder = new IRemoteService.Stub() {
public int getPid(){
return Process.myPid();
}
public void basicTypes(int anInt, long aLong, boolean aBoolean,
float aFloat, double aDouble, String aString) {
// Does nothing
}
};
Expose the interface
implementation Service to the client and override onBind() to return an implementation of the Stub class.
public class RemoteService extends Service {
@Override
public void onCreate() {
super.onCreate();
}
@Override
public IBinder onBind(Intent intent) {
// Return the interface
return mBinder;
}
private final IRemoteService.Stub mBinder = new IRemoteService.Stub() {
public int getPid(){
return Process.myPid();
}
public void basicTypes(int anInt, long aLong, boolean aBoolean,
float aFloat, double aDouble, String aString) {
// Does nothing
}
};
}
Call the steps
To invoke the remote interface defined using AIDL, the calling class must perform the following steps:
Add the.aidl file to the project SRC/directory. Declares an instance of the IBinder interface (generated based on AIDL). Realize the ServiceConnection. Call Context.bindService() to pass in your implementation of ServiceConnection. In your onServiceConnected() implementation, you will receive an IBinder instance (named Service). Call YourInterfaceName. Stub. AsInterface ((IBinder) service), to the types of parameters can be converted into YourInterface will return. Invoke the method you defined on the interface. You should always catch DeadObjectExceptions, which are thrown when a connection is broken; This will be the only exception thrown by the remote method. To disconnect, call Context.unbindService() using your instance of the interface.
Steps are not introduced on the official website steps specific jump to the official website
Cause: The client failed to bind the Service on the server side. The Service on the server side could not be called by the external application
When a server registers a Service in Manifast file, add android:exported=”true” attribute to set the Service to be invoked by external applications
<service android:name=".IRemoteService"
android:exported="true"/>
I will summarize the problems I encountered in learning AIDL today.
q.1 in the created entity class Book is in creating the Book. The aidl is wrong “Interface name must be unique”?
the solution: 1.
method to remove entity class, you first create the Book. The aidl file for creating entity class Book. The method of Java
2. When you have created an.aidl file, change the file name to Book
.
solution: this error is. Aidl document compilation errors, entity class must be serialized, implementing an interface Parceable, in a file. An aidl it needs to be referenced in the introduction file package name, even in the same package must also import
3. Run times wrong collapse Java. Lang. SecurityException: Binder invocation to the an incorrect interface?
the solution: storage is due to two projects. Aidl files do not match the package name, need to be unified, entity class must also be unified.
>
>
>
>
>
>
>
https://blog.csdn.net/zqurapig/article/details/109474011
https://blog.csdn.net/itTalmud/article/details/107517449
\build\intermediates\res\ resources-anzhi-debug-ap_ ‘specified for property ‘resourceFile’ does not exist, so I found a lot of information on the web.
Some say that the version of SDK is lower than the version of ADT. It is suggested to upgrade the SDK version. Some say that an option of the Android Studio setting is removed.
Finally on the net or found a solution to the code, now record.
In fact, we only need to modify the build.gradle code
BuildTypes {
release {
does not display the LOG/* * * */confused
/* * * */
/minifyEnabled false Zipalign optimization * * * */
zipAlignEnabled true
Remove useless resource files/* * * */
shrinkResources true
proguardFiles getDefaultProguardFile (‘ proguard – android. TXT), ‘proguard – rules. Pro’
}
The debug {
minifyEnabled false shrinkResources false
proguardFiles getDefaultProguardFile (‘ proguard – android. TXT), ‘proguard – rules. Pro’
}}
ShrinkResources = false Release ShrinkResources = false Interested can go to the Internet to check the reason.
The Android packaging problem is solved.
It’s as simple as that.
Today, I upgraded Android Studio and found that the code can run, but there is an error in the release package. The error is as follows
Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
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
}
}
The error provides us with the above two kinds of repair way of version
a: repair
Lint to check out the problem 2: in the build of the module. The gradle add the following code, so you can ignore these problems, the normal packaging
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
}
}
The second method is convenient, but it’s not recommended to ignore the problem, according to the website
In addition to testing the Android application to make sure it meets its functional requirements, you must also make sure that the code has no structural problems. Disorganized code affects the reliability and efficiency of an Android application and makes it harder to maintain the code.
Lint check problems is to prevent the above problems, so the way we use the following method to solve this problem
in the error above only hint Lint has a problem But didn’t tell me about any problem. Can use the android studio to see these errors
in the menu bar
can complete inspection can also specify folder check, click OK to wait for a while can see the test result, and then the error of the test results to solve can normal packing up
Reference links
https://developer.android.google.cn/studio/write/lint?hl=zh-CN
preface
One of the most common mistakes Android makes when debugging is when your app crashes.
=
=
At this point, the problem is solved by executing adb.exe again.