Round and round, round and round, back to the old days.
preface
Young, back pack, alone, only for frivolous pride.
A few years later, the computer in front of the teacup, silently watching the beating characters.
Back in the past, it seems to leave the industry one day, disappear like a splash, silent, clear.
Record the Android experience encountered a bit of the problem, just for the next faster processing ~!
Aim at chicken boss ~! Bju international ~!
1. Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6
Solution:
Add the following to build.gradle:
android { // ... compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } // ... }Copy the code
- Click on me to view Stack Overflow solutions directly
2. Sourcetree remote: Invalid username or password
Solutions:
-
On OSX Sourcetree > Preferences > Git > Use System Git.
-
Click on me to view Stack Overflow solutions directly
3. The android: screenOrientation = “portrait” have been warned to red
Add the following to application:
tool:ignore="LockedOrientationActivity"
Copy the code
- Developer
4. kotlin.NotImplementedError: An operation is not implemented: Not yet implemented
Remove TODO XXX from the code
- Click on me to view Stack Overflow solutions directly
5. Html.fromhtml loading strings. XML invalid (2020-04-14)
Use the following block to wrap the original String:
<! [CDATA[what to display]]>Copy the code
The explanation is as follows:
- By
tag are represented as plain text, such as
indicates text <. (I add a space here for easy display, but use it carefully.)
For ease of understanding, details are attached:
<string name="txt_permission_desc"><! [CDATA] In order to provide you with complete services, XXX applies to you for the following permissions: Equipment information < br / > < b > < / b > < br / > is used to protect your interaction operation safety < br / > < b > storage < / b > < br / > used to cache the article image information < br / > < b > camera photo < / b > < br / > used to feedback the Bug And suggestions for modification]]></string>Copy the code
- Click on me to view Stack Overflow solutions directly
6. App Name has special characters (2020-04-16)
First of all, strings cannot contain special characters. If it does, it needs to be processed separately. For example, App Name is displayed as follows:
- XXX ‘ XXX
Writing ‘directly will cause the compilation to fail. You need to find the encoding for the symbol, for example:
<string name="app_name">XXX´ s XXX</string>Copy the code
7. ERROR: Resource Shrinker cannot be used for libraries. (2020-05-06)
ShrinkResources cannot be used in Android Lib.
8. Error: cannot find or fail to load the main class org. Gradle. Wrapper. GradleWrapperMain
The jar in question has a size of 0.
Substitution.
9. DSL element ‘android.viewBinding.enabled’ is obsolete and has been replaced with ‘android.buildFeatures.viewBinding’. It will be removed in Version 5.0 of the Android Gradle Plugin. (2020-08-25)
Solution:
Android {//... DefaultConfig {//... } buildTypes {//... BuildFeatures {dataBinding = true // geadle 4.x viewBinding = true // Gradle 5.x +}}Copy the code
Thanks
- Stack Overflow