搜尋此網誌
2017年12月31日 星期日
【Android Studio】Instant Run is disabled for non-debug variants
If you have manually set it in the manifest, then remove it and let the IDE automatically assign it.
If you are using Gradle, make sure that your current variant is debuggable.
buildTypes {
release {
debuggable true //發佈時 記得改為false
}
2017年12月4日 星期一
2017年9月10日 星期日
【Android Studio】在使用hot key 找某些類別的reference時 出現"cannot find declaration to go to"
ref:
https://stackoverflow.com/a/35455980
好像每次出現這種狀況,印象中,都是出現在update之後,才發生。
所以記錄一下。
https://stackoverflow.com/a/35455980
好像每次出現這種狀況,印象中,都是出現在update之後,才發生。
所以記錄一下。
- close the project in intellij.
- close intellij.
- go to the project folder and delete the
.ideafolder - restart intellij and open the project (wait for the indexing to finish) and it would work.
步驟中的intellij -->換成 Android Studio也是可行的。
2016年8月20日 星期六
【Android Studio】ddms: 'adb.exe,start-server' failed — run manually if necessary
ref :
http://stackoverflow.com/a/38310713
每次都是Android Studio更新後,就出現一對問題
一下子是Grandle有錯誤,弄了好久,之後又出現
ddms: 'adb.exe,start-server' failed — run manually if necessary
連不上Genymotion
所以沒事不要更新。
解決辦法:
http://stackoverflow.com/a/38310713
每次都是Android Studio更新後,就出現一對問題
一下子是Grandle有錯誤,弄了好久,之後又出現
ddms: 'adb.exe,start-server' failed — run manually if necessary
連不上Genymotion
所以沒事不要更新。
解決辦法:
Sometimes there are conflicts between ADB Genymotion and ADB SDK because both of them use the same port. So I recommend always set up ADB Genymotion to use the ADB SDK, in that way to avoid incompatible issues.
Genymotion-> Settings -> ADB -> Use custom Android SDK tools (here your set up your sdk android location).
2016年6月5日 星期日
2016年5月29日 星期日
【Android Studio】幫apk檔自動加上version code和version name
ref:
http://www.2cto.com/kf/201601/487405.html
在build.gradle檔打開
android block 中,新增
http://www.2cto.com/kf/201601/487405.html
在build.gradle檔打開
android block 中,新增
android.applicationVariants.all { variant -> variant.outputs.each { output -> output.outputFile = new File(output.outputFile.parent, "名稱_" + defaultConfig.versionCode + "_v" + defaultConfig.versionName + "_" + buildType.name + ".apk"); } }
2016年4月9日 星期六
【Android Studio】SDK 更新至Android N後,在xml預覽視窗出現Rendering Problem
"Failed to load the LayoutLib: com/android/layoutlib/bridge/Bridge : Unsupported major.minor version 52.0"
解決:
Usually you get error: Unsupported major.minor version 52.0
If you have installed Android N, change Android rendering version with older one and the problem will disappear.
ref:
http://stackoverflow.com/a/35917202
ref:
http://stackoverflow.com/a/35917202
2015年12月6日 星期日
2015年9月1日 星期二
【Android Studio】如何開啟logcat
建立時間:2015-09-01
更新時間:2016-03-04
ref:
更新時間:2016-03-04
ref:
- ref: http://stackoverflow.com/a/16817720
按 Alt + 6 - 記錄一下
- 首先開啟Android Studio(廢話...)
- Tools > Android > Enable ADB Integration選項有勾起,沒有的話就點一下。
- 再次確認Enable ADB Integration選項有勾起。
- Tools > Android > Android Device Monitor 點一下,需要等一下。
- Android Device Monitor 打開後,可以double check 要模擬的device或app name,log會在右下方出現。
- 點選綠色+號(左下角),設定新的過濾器規則。
橘黃色的log可以不用太在意,只是警告;但紅色的log就要特別注意了,是屬於嚴重錯誤。
ref:影片支援
2015年8月14日 星期五
【Android Studio】auto import all of the shortcut
心得:
從Eclipse轉到Android Studio實在太累了,一堆功能又不太一樣,一直卡在Debug要如在AS上操作比較順利,常常知道Eclipse的功能,但轉到AS不知道要去哪裡設定?再加上英文關鍵字也不知道要如何下?
比如說:
URL url = new URL();
使用eclipse時(Shift+Ctrl+O)會自動說明需要加上try ... catch ...exception 或 throws ...exception,並自動產生出來。
但在AS只會和你說 Unhandled exception: ...之類的,但是要如何解決,需要自己去查api要如何使用,沒有直接提示。
其實是有的,只是這個功能被關閉哩 (= =|||)
StackOverflower類似的問題:
Is there any way of auto importing (like in Eclipse Shift+Ctrl+O) in Android Studio?
I have found only Ctrl+Alt+O which ask for each thing, and I have to press Alt+Enter to accept it.
No way to do it faster?
For Windows/Linux, you can go to
File -> Settings -> Editor -> General -> Auto Import -> Java and make the following changes:- change
Insert imports on pastevalue toAll - mark
Add unambigious imports on the flyoption as checked
On a Mac, do the same thing in
Android Studio -> Preferences【Android Studio】ActionBarActivity is deprecated
ref:
http://developer.android.com/tools/support-library/index.html
http://android-developers.blogspot.tw/2015/04/android-support-library-221.html
Since the version 22.1.0, the class
解決方法:
https://www.youtube.com/watch?t=49&v=5Be2mJzP-Uw
需修改以下兩處:
http://developer.android.com/tools/support-library/index.html
http://android-developers.blogspot.tw/2015/04/android-support-library-221.html
Since the version 22.1.0, the class
ActionBarActivity is deprecated. You should use AppCompatActivity.解決方法:
https://www.youtube.com/watch?t=49&v=5Be2mJzP-Uw
需修改以下兩處:
- AndroidManifest.xml
- <application android:theme="@style/Theme.AppCompat">
- MainActivity.xml
- public class MainActivity extends AppCompatActivity
2015年8月7日 星期五
2015年7月5日 星期日
【Android Studio】快捷鍵(Hot Key) /快速設置為Eclipse的快捷鍵
- 快捷鍵
- Ctrl + Alt + Space show template proposals
- 還是不習慣AS的快捷鍵,直接將Android Studio的快捷鍵快速設置為Eclipse的快捷鍵。
- File > Settings > 輸入 keymap > 在keymaps選項中,選擇Eclipse,即可。
- 顯示行數(line number)
- File > Settings > Editor > General > Appearance > Show line number打勾即可。
2015年5月31日 星期日
【Android】Hax kernel module is not installed
最近想改用Android Studio作為Android 的開發(之前使用Eclipse),可是要執行ADT時,卻出現Hax kernel module is not installed.的錯誤訊息,按字面翻譯應該就是Hax kernel module 沒有安裝。
經過辜狗後(使用intel cpu 才有支援此技術),其實疑難排解如下:
但是實際測試,使用ADT沒有比使用Genymotion模擬器來的快。另外使用amd CPU的coder,因為amd沒有支援虛擬化技術,所以也可改用Genymotiony開發。
ref:https://www.youtube.com/watch?v=Ar9_FUFJhDU
經過辜狗後(使用intel cpu 才有支援此技術),其實疑難排解如下:
- Intel CPU:先確認有支援Virtualization technology(虛擬化技術),可透過官網查詢。
- BIOS設定:不知從哪一版CPU開始,Virtualization technology選項預設是關閉的,所以需要到BIOS把設定打開。
- 下載HAX,有以下兩種方式:
- 使用Android SDK Manager下載:Extra → Intel X86 Emulator Accelerator(HAXM installer) 勾選 → Install package下載。
- 找到該SDK安裝路徑:回到Android Studio畫面左上角File → Project Structure,找到sdk資料夾路徑,sdk → extras → intel → Hardware_Accelerated_Execution_Manager → intelhaxm-android.exe,安裝即可。
- 官網下載(https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager)。
但是實際測試,使用ADT沒有比使用Genymotion模擬器來的快。另外使用amd CPU的coder,因為amd沒有支援虛擬化技術,所以也可改用Genymotiony開發。
ref:https://www.youtube.com/watch?v=Ar9_FUFJhDU
訂閱:
文章 (Atom)
