Android-Studio-插件小结

本文介绍了多个提高Android Studio开发效率的插件,包括快速生成getset方法、代码后缀自动补全、代码快速定位预览等,还提供了ButterKnife注解、实现Parcelable接口的代码生成插件及JSON数据快速解析成实体的方法。

最近在使用AS时, 发现好多比较好用的插件,现将个人使用较多的进行归纳一下.

快速生成 get set 方法

GitHub地址:点我

用法:在AS中打开Setting界面:

Preferences > Plugins > Browse repositories... > Search for "AndroidAccessors" > Install Plugin

在代码中写完Java Bean对象后,按下Alt+Insert后选择AndroidAccessors即可

代码后缀自动补全

GitHub地址: 点我

用法: 同上, 搜索 android postfix completion 即可

作用:

Postfix ExpressionDescriptionExample
.toastCreate and show Toast.Toast.makeText(context, expr, Toast.LENGTH_SHORT).show()
.logLogging. If there is constant variable “TAG”, it use “TAG” . Else it use class name.Log.d(TAG, expr)
.logdLogging. If BuildConfig.DEBUG is true, Log message.if (BuildConfig.DEBUG) Log.d(TAG, expr)
.findTyped FindView(ViewType) findViewById(expr)
.isempCheck empty.TextUtils.isEmpty(expr)
.vgDivide view visible or gone.(expr) ? View.VISIBLE : View.GONE

注意:在使用 .log 时,如果需要显示格式为Log.d(TAG,expr) 的话,需要在当前Activity中定义static final String TAG = "MainActivity"

.vg 暂时没找到怎么使用

代码快速定位 预览

GitHub地址:点我

用法:搜索CodeGlance安装重启后即可看到效果

快速生成ButterKnife注解

ActivityFragment 中,从所选的XML布局文件生成ButterKnife注解;

GitHub地址:点我

用法: 搜索ButterKnifeZelezny安装重启后即可
注意: 需要项目依赖Butterknife

1 将光标放在xml后面,(如 setContentView(R.layout.activity_main)后面)
2 然后右键或者按下Alt+Insert ,选择 Generate ButterKnife Injections 即可
3 选择需要生成注解的控件
4 然后点击 confirm 即可

生成实现Parcelable接口的代码插件

生成实现了Parcelable接口的代码的插件。在你的类中,按下alt + insert键弹出插入代码的上下文菜单,你会看到在下面有一个Parcelable,选中后即可插入实现该接口的代码

GitHub地址:点我

用法: 搜索Parcelable Generator安装重启后即可

将Json数据快速解析成实体,从此不再写JavaBean

GitHub地址:点我

用法: 搜索GsonFormat安装重启后即可,具体使用步骤参见GitHub

zhouweixiang@KI-ZJ-2961:~$ ps aux | grep -i studio zhouwei+ 2303845 21.3 24.0 13819648 3875352 ? Sl 11:36 53:15 /home/zhouweixiang/下载/android-studio/jbr/bin/java -classpath /home/zhouweixiang/下载/android-studio/lib/platform-loader.jar:/home/zhouweixiang/下载/android-studio/lib/util-8.jar:/home/zhouweixiang/下载/android-studio/lib/util.jar:/home/zhouweixiang/下载/android-studio/lib/util_rt.jar:/home/zhouweixiang/下载/android-studio/lib/trove.jar:/home/zhouweixiang/下载/android-studio/lib/app.jar:/home/zhouweixiang/下载/android-studio/lib/opentelemetry.jar:/home/zhouweixiang/下载/android-studio/lib/jps-model.jar:/home/zhouweixiang/下载/android-studio/lib/stats.jar:/home/zhouweixiang/下载/android-studio/lib/rd.jar:/home/zhouweixiang/下载/android-studio/lib/external-system-rt.jar:/home/zhouweixiang/下载/android-studio/lib/protobuf.jar:/home/zhouweixiang/下载/android-studio/lib/bouncy-castle.jar:/home/zhouweixiang/下载/android-studio/lib/intellij-test-discovery.jar:/home/zhouweixiang/下载/android-studio/lib/forms_rt.jar:/home/zhouweixiang/下载/android-studio/lib/lib.jar:/home/zhouweixiang/下载/android-studio/lib/externalProcess-rt.jar:/home/zhouweixiang/下载/android-studio/lib/groovy.jar:/home/zhouweixiang/下载/android-studio/lib/annotations.jar:/home/zhouweixiang/下载/android-studio/lib/idea_rt.jar:/home/zhouweixiang/下载/android-studio/lib/kotlinx-coroutines-slf4j-1.8.0-intellij.jar:/home/zhouweixiang/下载/android-studio/lib/resources.jar -XX:ErrorFile=/home/zhouweixiang/java_error_in_studio_%p.log -XX:HeapDumpPath=/home/zhouweixiang/java_error_in_studio_.hprof -Xms256m -Xmx2048m -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -XX:CICompilerCount=2 -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:TieredOldPercentage=100000 -ea -Dsun.io.useCanonCaches=false -Dsun.java2d.metal=true -Djbr.catch.SIGABRT=true -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Djdk.nio.maxCachedBufferSize=2097152 -Djava.util.zip.use.nio.for.zip.file.access=true -Dkotlinx.coroutines.debug=off -Dsun.tools.attach.tmp.only=true -Dawt.lock.fair=true -Djb.vmOptionsFile=/home/zhouweixiang/下载/android-studio/bin/studio64.vmoptions -Xbootclasspath/a:/home/zhouweixiang/下载/android-studio/lib/nio-fs.jar -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.vendor.name=Google -Didea.paths.selector=AndroidStudio2025.1.1 -Djna.boot.library.path=/home/zhouweixiang/下载/android-studio/lib/jna/amd64 -Djna.nosys=true -Djna.noclasspath=true -Dpty4j.preferred.native.folder=/home/zhouweixiang/下载/android-studio/lib/pty4j -Dio.netty.allocator.type=pooled -Dintellij.platform.runtime.repository.path=/home/zhouweixiang/下载/android-studio/modules/module-descriptors.jar -Didea.platform.prefix=AndroidStudio -XX:FlightRecorderOptions=stackdepth=256 --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED -Djava.security.manager=allow -Dij.startup.error.report.url=https://issuetracker.google.com/issues/new?component=192708 -XX:CompileCommand=exclude,org.jetbrains.kotlin.serialization.deserialization.TypeDeserializer::simpleType -XX:CompileCommand=exclude,org.jetbrains.kotlin.serialization.deserialization.TypeDeserializer::toAttributes -Dsplash=true -Daether.connector.resumeDownloads=false -Dcompose.swing.render.on.graphics=true --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.ref=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED --add-opens=java.base/sun.net.dns=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED --add-opens=java.base/sun.security.ssl=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/java.awt.dnd.peer=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.desktop/java.awt.image=ALL-UNNAMED --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED --add-opens=java.desktop/sun.awt.datatransfer=ALL-UNNAMED --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED --add-opens=java.desktop/sun.java2d=ALL-UNNAMED --add-opens=java.desktop/sun.swing=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-opens=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED com.android.tools.idea.MainWrapper zhouwei+ 2304091 0.0 0.0 4136 2280 ? S 11:36 0:01 /home/zhouweixiang/下载/android-studio/bin/fsnotifier zhouwei+ 2304143 0.2 3.5 1898840 571504 ? Sl 11:36 0:39 /home/zhouweixiang/下载/android-studio/plugins/c-clangd/bin/clang/linux/x64/bin/clangd --clion-mode=clion-main -update-debounce=0 -index=false -include-ineligible-results -clang-tidy=0 -resource-dir=/home/zhouweixiang/下载/android-studio/plugins/c-clangd/bin/clang/linux/x64 -keep-asts=30 -ranking-model=heuristics -clion-extra-completion-preamble -clion-keep-obsolete-ast=false -header-extensions=h;h; zhouwei+ 2361297 7.0 9.9 10161420 1604020 ? Ssl 13:54 7:48 /home/zhouweixiang/下载/android-studio/jbr/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=CN -Duser.language=zh -Duser.variant -cp /home/zhouweixiang/test/git/code-S32/03IMPLEMENT/0301Code/ISA-NaviService/wrapper/dists/gradle-8.11.1-bin/aqblo1612keip6ox4t4vpymx1/gradle-8.11.1/lib/gradle-daemon-main-8.11.1.jar -javaagent:/home/zhouweixiang/test/git/code-S32/03IMPLEMENT/0301Code/ISA-NaviService/wrapper/dists/gradle-8.11.1-bin/aqblo1612keip6ox4t4vpymx1/gradle-8.11.1/lib/agents/gradle-instrumentation-agent-8.11.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.11.1 zhouwei+ 2386683 0.0 0.0 14488 5340 pts/6 Ss+ 14:37 0:00 /bin/bash --rcfile /home/zhouweixiang/下载/android-studio/plugins/terminal/shell-integrations/bash/bash-integration.bash -i zhouwei+ 2415177 0.2 1.3 1864704 210168 ? Sl 15:35 0:01 /home/zhouweixiang/下载/android-studio/plugins/android-ndk/resources/lldb/bin/LLDBFrontend 42885 zhouwei+ 2420184 0.0 0.0 12132 2604 pts/0 S+ 15:45 0:00 grep --color=auto -i studio zhouweixiang@KI-ZJ-2961:~$
最新发布
08-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值