1.多語言設(shè)置:
https://blog.csdn.net/qq_21983189/article/details/73735278
https://blog.csdn.net/gh8609123/article/details/62440795
2.導(dǎo)入舊項目慢:
改gradle的版本。
改local.properties配置。
改classpath
3.經(jīng)典bug
Error:Execution failed for task ':app:transformClassesWithDesugarForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments {@C:\projects\sxyz\app\build\intermediates\tmp\desugar_args4363382331831664290}+
怎么build都不行,更換jdk就好了。

4.Could not reserve enough space for 1572864KB object heap。
當(dāng)前項目gradle.properties中:org.gradle.jvmargs=-Xmx1536m 改成
org.gradle.jvmargs=-Xmx1536
MaxHeapSize=512m
或者直接改成:
org.gradle.jvmargs=-Xmx512m
在as啟動頁面:
5.讓輸入法自動彈出:
android:windowSoftInputMode="stateVisible|adjustPan"
隱藏:android:windowSoftInputMode="stateVisible|stateHidden"
6."stateHidden|adjustResize"和"stateHidden|adjustPan"區(qū)別:
"adjustResize"在使用時,布局會被軟鍵盤頂上去,體驗非常不好
"adjustPan"在使用時獲取焦點的控件下邊的View將會被軟鍵盤覆蓋。
stateHidden與stateAlwaysHidden:
stateHidden:用戶選擇activity時,軟鍵盤總是被隱藏。
stateAlwaysHidden:當(dāng)該Activity主窗口獲取焦點時,軟鍵盤也總是隱藏的。
stateVisible與stateAlwaysVisible:
stateVisible:軟鍵盤通常是可見的。
stateAlwaysVisible:用戶選擇activity時,軟鍵盤總是顯示的狀態(tài)。
6.Google官方demo網(wǎng)站:https://github.com/googlesamples
- Error:(16, 49) String types not allowed (at 'layout_constraintBottom_toBottomOf' with value 'parent')
錯誤布局:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
修改方法:在根目錄添加id。
android:id="@+id/lay_root"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_main"
tools:context="com.cheerchip.testskining.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="@+id/lay_root"
app:layout_constraintLeft_toLeftOf="@+id/lay_root"
app:layout_constraintRight_toRightOf="@+id/lay_root"
app:layout_constraintTop_toTopOf="@+id/lay_root" />
8
.java.lang.ClassCastException: android.graphics.drawable.VectorDrawable cannot be cast to android.graphics.drawable.BitmapDrawable
以為是不能強(qiáng)轉(zhuǎn),結(jié)果魅族pro6s報錯,其余幾臺測試機(jī)ok。重啟了幾遍AS,結(jié)果就好了。
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
刪除:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7'
apply plugin: 'android-apt'
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
10.Disconnected from the target VM, address: 'localhost:8601', transport: 'socket'
項目正常能跑,調(diào)試就奔潰。突然之間就出現(xiàn)了這個問題。
第一反應(yīng),去看有沒有端口沖突。沒有。第二份反應(yīng),回憶有沒有做別的操作,沒有。
于是重啟AS,重啟電腦,依舊不行。開始百度,谷歌,各種方法,試了十來種,一個都不行。
機(jī)智的同事,把我的網(wǎng)線拔了,重啟AS就好了。
This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. 解決辦法: <item name="windowNoTitle">true</item>android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.v7.
Didn't find class "android.support.v7." on path: DexPathList[[zip file "/data/app/com.szmaiji.sxyz-1/base.apk", zip file "/data/app/com.szmaiji.sxyz-1
布局錯了:<android.support.
13.No cached version of com.android.support:multidex:1.0.2 available for offline
去掉File-Setting-Gradle-Offline work
14.Unknown failure (at android.os.Binder.execTransact(Binder.java:574))
Error while Installing APKs
File ---> Settings ---> Build,Execution,Deployment ---> Instant Run
把Enable Instant Run to選項去掉再重新運(yùn)行一遍就通過了
15.微信回調(diào)失敗。
微信沒有回調(diào)一般就兩點,要么是回調(diào)類配置位置不對,要么就是簽名包名不一致,所以要先檢查回調(diào)信息的,如果是代碼不對會進(jìn)失敗的回調(diào)有錯誤信息的,依次檢查看看。
Android dependency 'com.android.support:appcompat-v7' has different version for the compile (25.3.1) and runtime (27.0.2) classpath. You should manually set the same version via DependencyResolution
17.Android Studio同步svn.
https://www.cnblogs.com/details-666/p/SVN.html
18.Error:null value in entry: aaptFriendlyManifestOutputDirectory=null
刪除.gradle,重新build就好。
19.Android Studio 打開是歡迎頁面:框住的地方取消選中

20.Only fullscreen opaque activities can request orientation
修改主題:
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowDisablePreview">true</item>
去掉: AndroidManifest.xml中 android:screenOrientation="portrait"
一般問題就是:android:windowIsTranslucent = true 或者android:screenOrientation="portrait" 引起的。
- You need to use a Theme.AppCompat theme (or descendant) with this activity.
自定義的style: <style name="MyDialogStyle1" parent="@style/Theme.AppCompat.Light.NoActionBar">
或者在 AndroidManifest.xml的相對應(yīng)的Activity那里, android:theme="@style/Theme.AppCompat.Light.NoActionBar"