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'
}
}
}
Read More:
- [Solved] Android Kotlin Package release Error: Lint found fatal errors while assembling a release target.
- The SDK of Android webrtc compiled with Ninja – C out / release command reported an error, and the Android NDK processing method could not be found
- Turn off eslint checksum and resolve formatting conflicts
- Android studio New kotlin project Error: org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21-release-315
- [Solved] Springboot WARNING: All illegal access operations will be denied in a future release
- Android Package Error: AAPT: error: IDAT: incorrect data check. AAPT: error: file failed to compile.
- [Solved] Helm install Error: Error: no available release name found
- [Solved] pagehelper Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 1’
- [Solved] Android12 Download Error: The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
- [Solved] Android Compile and Package Error: Invalid keystore format
- Error starting ApplicationContext. To display the auto-configuration report re-run your application
- [Solved] UE4 Android Package Error: failed for task :permission_library:compileDebugJavaWithJavac
- [Solved] error processing package libapache2-mod-php7.2
- [Solved] R Install XML package error: configuration failed for package ‘XML’
- Flutter android studio runs gradle build error: Could not resolve all artifacts for configuration’:classpath’.
- [Solved] error: package android.support.design.widget does not exist
- [Solved] Android Studio 4 Error: The application could not be installed: INSTALL_FAILED_OLDER_SDK
- [Solved] Event Log Error: Failed to retrieve application JMX service URL
- [Solved] UE4 Android Package Error: cmd.exe failed with args
- [Solved] Android app development version update failed, Android – error: task execution failed ‘: app: com