aapt:aapt即Android Asset Packaging Tool,在SDK的build-tools目录下。该工具可以查看,创建, 更新ZIP格式的文档附件(zip, jar, apk)。也可将资源文件编译成二进制文件,尽管你可能没有直接使用过aapt工具,但是build scripts和IDE插件会使用这个工具打包apk文件构成一个Android 应用程序。在使用aapt之前需要在环境变量里面配置SDK-tools路径,或者是路径+aapt的方式进入aapt
java.lang.NullPointerException
at com.intellij.openapi.wm.impl.ToolWindowsPane.createRemoveDecoratorCmd(ToolWindowsPane.java:272)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.appendRemoveDecoratorCmd(ToolWindowManagerImpl.java:1652)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.applyInfo(ToolWindowManagerImpl.java:1182)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.deactivateToolWindowImpl(ToolWindowManagerImpl.java:728)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.projectClosed(ToolWindowManagerImpl.java:549)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl$2.projectClosed(ToolWindowManagerImpl.java:162)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:397)
at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:358)
at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:347)
at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:324)
at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:29)
at com.intellij.util.messages.impl.MessageBusImpl 2. i n v o k e ( M e s s a g e B u s I m p l . j a v a : 196 ) a t c o m . s u n . p r o x y . 2.invoke(MessageBusImpl.java:196) at com.sun.proxy. 2.invoke(MessageBusImpl.java:196)atcom.sun.proxy.Proxy21.projectClosed(Unknown Source)
at com.intellij.openapi.project.impl.ProjectManagerImpl.fireProjectClosed(ProjectManagerImpl.java:813)
at com.intellij.openapi.project.impl.ProjectManagerImpl.lambda$closeProject$15(ProjectManagerImpl.java:702)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1057)
at com.intellij.openapi.project.impl.ProjectManagerImpl.closeProject(ProjectManagerImpl.java:699)
at com.intellij.openapi.project.impl.ProjectManagerImpl.closeAndDispose(ProjectManagerImpl.java:723)
at com.intellij.ide.impl.ProjectUtil.closeAndDispose(ProjectUtil.java:97)
at com.intellij.ide.actions.CloseProjectAction.actionPerformed(CloseProjectAction.java:42)
at com.intellij.openapi.actionSystem.ex.ActionUtil 1. r u n ( A c t i o n U t i l . j a v a : 258 ) a t c o m . i n t e l l i j . o p e n a p i . a c t i o n S y s t e m . e x . A c t i o n U t i l . p e r f o r m A c t i o n D u m b A w a r e ( A c t i o n U t i l . j a v a : 275 ) a t c o m . i n t e l l i j . o p e n a p i . a c t i o n S y s t e m . i m p l . A c t i o n M e n u I t e m 1.run(ActionUtil.java:258) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:275) at com.intellij.openapi.actionSystem.impl.ActionMenuItem 1.run(ActionUtil.java:258)atcom.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:275)atcom.intellij.openapi.actionSystem.impl.ActionMenuItemActionTransmitter.lambda$actionPerformed 0 ( A c t i o n M e n u I t e m . j a v a : 287 ) a t c o m . i n t e l l i j . o p e n a p i . w m . i m p l . F o c u s M a n a g e r I m p l . r u n O n O w n C o n t e x t ( F o c u s M a n a g e r I m p l . j a v a : 283 ) a t c o m . i n t e l l i j . o p e n a p i . w m . i m p l . I d e F o c u s M a n a g e r I m p l . r u n O n O w n C o n t e x t ( I d e F o c u s M a n a g e r I m p l . j a v a : 106 ) a t c o m . i n t e l l i j . o p e n a p i . a c t i o n S y s t e m . i m p l . A c t i o n M e n u I t e m 0(ActionMenuItem.java:287) at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283) at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106) at com.intellij.openapi.actionSystem.impl.ActionMenuItem 0(ActionMenuItem.java:287)atcom.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283)atcom.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106)atcom.intellij.openapi.actionSystem.impl.ActionMenuItemActionTransmitter.actionPerformed(ActionMenuItem.java:277)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed 0 ( A c t i o n M e n u I t e m . j a v a : 111 ) a t c o m . i n t e l l i j . o p e n a p i . a p p l i c a t i o n . T r a n s a c t i o n G u a r d I m p l . r u n S y n c T r a n s a c t i o n ( T r a n s a c t i o n G u a r d I m p l . j a v a : 88 ) a t c o m . i n t e l l i j . o p e n a p i . a p p l i c a t i o n . T r a n s a c t i o n G u a r d I m p l . l a m b d a 0(ActionMenuItem.java:111) at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88) at com.intellij.openapi.application.TransactionGuardImpl.lambda 0(ActionMenuItem.java:111)atcom.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)atcom.intellij.openapi.application.TransactionGuardImpl.lambdasubmitTransaction$1(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:524)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access 300 ( B e g M e n u I t e m U I . j a v a : 35 ) a t c o m . i n t e l l i j . u i . p l a f . b e g . B e g M e n u I t e m U I 300(BegMenuItemUI.java:35) at com.intellij.ui.plaf.beg.BegMenuItemUI 300(BegMenuItemUI.java:35)atcom.intellij.ui.plaf.beg.BegMenuItemUIMyMouseInputHandler.mouseReleased(BegMenuItemUI.java:546)
at java.awt.Component.processMouseEvent(Component.java:6548)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at java.awt.Component.processEvent(Component.java:6313)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4903)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue 3. r u n ( E v e n t Q u e u e . j a v a : 709 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t j a v a . s e c u r i t y . P r o t e c t i o n D o m a i n 3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain 3.run(EventQueue.java:709)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue 4. r u n ( E v e n t Q u e u e . j a v a : 735 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t j a v a . s e c u r i t y . P r o t e c t i o n D o m a i n 4.run(EventQueue.java:735) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain 4.run(EventQueue.java:735)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:755)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:700)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
如图?
***【解决办法】***?
file—>settings->plugins->取消android ndk support->ok->apply->ok->restart
原因:AS更新而gradle没有及时更新
***【解决办法】***?
File – Setting – Gradle – 取消勾选Offine work,选择 默认的gradle wrapper
原因:目录所示的git项目不存在
***【解决办法】***?
The specified Android SDK Build Tools version (26.0.2) is ignored,
as it is below the minimum supported version (28.0.3) for Android
Gradle Plugin 3.4.2. Android SDK Build Tools 28.0.3 will be used. To
suppress this warning, remove “buildToolsVersion ‘26.0.2’” from your
build.gradle file, as each version of the Android Gradle Plugin now
has a default version of the build tools. Remove Build Tools version
and sync project Affected Modules: nlecloud-sdk
原因:依赖包冲突build.gradle中compileSdkVersion 版本号与buildToolsVersion不匹配。
【解决办法】?
看提示应该是com.android.support:design版本和com.android.support:appcompat中显示的版本冲突,这时候把design版本置换即可,在dependencies中加入:
`implementation 'com.android.support:design:27.1.1'`
改为匹配即可。
Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
原因:Android studio版本升级
【解决办法】?
将’compile’替换为’implementation’ 或 ‘api’
Error:(12, 23) Gradle: package com.google.gson does not exist
Error:(37, 3) Gradle: cannot find symbol class Gson
Error:(37, 19) Gradle: cannot find symbol class Gson
原因:将它作为依赖项添加到项目结构设置中是不够的。该设置仅适用于IDE。要实际构建,Gradle还需要知道它。
【解决办法】?
法一:将.jar文件添加到您的build.gradle文件中
dependencies {
implementation files('libs/gson-2.8.1.jar')
}
法二:
dependencies {
implementation 'com.google.code.gson:gson:2.8.1'
}
添加到build.gradle文件
dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
}
解压文件报错
可能原因:文件不完整或损坏,重新下载即可
RROR: The minSdk version should not be declared in the android manifest file.You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove minSdkVersion and sync project
Affected Modules: app
原因:
在Android Studio 3.0之后,app的AndoridManifest.xml中要把SDK的最小版本去掉,这些设置必须要设置在gradle志中.
解决:
去掉AndroidManifest.xml中的
Android Studio 出现:
Executing tasks: [:app:assembleDebug]
Gradle build finished in 2s 196ms
Session ‘app’: Error Launching activity
关于标题问题网上能搜索到的相关网页大部分都是 Eclipse 下的解决方法,如:
修改 ADB connection time out(ADB的超时时间)设置。
Window->Preferences->Android->DDMS。
增大 ADB connection time out(图片来源见水印)
现在提供两种在 Android Studio 中出现该问题的解决办法:
手动更新 Gradle 插件。
本办法用于解决可能是由于打开 Android Studio 后网络原因自动更新 Gradle 插件失败所导致的。
Tools -> Android -> Sync Project with Gradle Files
更新 Gradle 插件
2.重新勾选 Enable ADB Integration。
本办法用于第 1 条无法解决的情况下使用。
Error running app: Instant Run requires ‘Tools | Android | Enable ADB integration’ to be enabled.
Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If it’s being used by something else, choose a new port number in the preferences.
Can’t bind to local 8600 for debugger
你的主机中的软件中止了一个已建立的连接。
3.另附一个相关问题链接。
https://segmentfault.com/q/1010000004951263
stackoverflow地址
一般解决办法:
在app的 build.gradle里添加以下两句:
defaultConfig中添加:
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
这个可以关闭Android Studio的PNG合法性检查
注意drawable和mipmap区别
drawable一般用来放用户自定义的图片,大小一定,不会再改变
推荐使用mipmap,大小可更改
尽量不要使用过大的图片,图标长款尽量在100px内