Posted onEdited onInandroid Symbols count in article: 611Reading time ≈2 mins.
Android Studio Tips -1
1. Wireless debugging with Android device
Select Pair Devices using Wi-Fi under emulator dropdown list.
Enable debug mode on your android device(see here for more details).
On your android device, select Settings | Developer options | Wireless debugging | Pair using QR code to enable wireless debugging.
2. Fix Manifest merged errors
Open AndroidManifest.xml file.
Click Merged Manifest tab at the bottom of the editor.
Scroll down to the bottom to see the errors.
3. View database file in Android Studio
Select View | Tools Window | App Inspection from the main menu.
Launch your app on a device/Emulator running API level 26 or higher.
If you see a red close icon on your database file which means your database was not opened, you can operate on your app to open the database(such as click a button, open a fragment or whatever action which can open the database).
If you database was opened, you can click the table under this database to view the data.
4. Filter logs in Logcat
Select Logcat at the bottom of Android Studio.
Select the emulator/device where your app runs on.
Focus the filter input box, and press Ctrl + Space to open the filter dialog. then select the filter options you want.
For example, if you want to see only error logs for package com.jiyuzhai.kaishuzidian, you can input package: com.jiyuzhai.kaishuzidian level: error as a filter.
5. Open xml layout file in split mode
Do you ever encounter this situation? whenever you open an xml layout file, it opens in design mode by default. You can do the following to open it in split mode by default.
Open Settings | Editor | Design Tools from the main menu.
Check Prefer XML editor option.
Click OK button.
File xxx already exists, it cannot be overwritten by SerializableChange(file=xxx, fileStatus=NEW, normalizedPath=xxx.class).
In Android menu, select Build | Clean Project, then rebuild, that’s it!
Android emulator stop working.
Delete the lock file under avd folder, here is the lock file path under android sdk folder.
Posted onEdited onInandroid Symbols count in article: 145Reading time ≈1 mins.
Android monorepo in action(Android monorepo实践)
What is monorepo(什么是monorepo)
In version control systems, a monorepo (“mono” meaning ‘single’ and “repo” being short for ‘repository’) is a software development strategy where code for many projects is stored in the same repository.
Steps
Create a folder named monorepo, this is the root folder of the monorepo.
Create folder mono-libraries under monorepo, this is the folder for shared libraries.
Create foldermono-build-logic under monorepo, this is the folder for gradle files.
// Use this method to replace the temp variable basePrice getbasePrice() { returnthis.quantity * this.item.price; }
// Use this method to replace the temp variable discountFactor getdiscountFactor() { let discountFactor = 0.98; if (this.basePrice > 1000) { discountFactor -= 0.03; } return discountFactor; }
In computer programming, monkey patching is a technique used to dynamically update the behavior of a piece of code at run-time. It is used to extend or modify the runtime code of dynamic languages such as Smalltalk, JavaScript, Objective-C, Ruby, Perl, Python, Groovy, and Lisp without altering the original source code. - Wikipedia
addName() { if (this.name.trim()) { this.nameList.push(this.name); } }
Nested Components
In Angular, components can be nested, for example, a Parent component can contain a Child component. Here is the lifecycle method order for nested components.
Event中除了这两个target之外,其实还有一个relatedTarget属性,这个属性在不同的事件中有不同的含义,比如在mouseover事件中,relatedTarget表示鼠标移入的元素,而在mouseout事件中,relatedTarget表示鼠标移出的元素。两外html5中的drag and drop api也会用到这个属性,比如在dragenter事件中,relatedTarget表示被拖拽元素正在进入的元素,而在dragleave事件中,relatedTarget表示被拖拽元素正在离开的元素。