我正在从Android Studio运行我的Android应用程序,并且Instant Run启动,这很棒.我想从命令行运行完全相同的东西.
在Android Studio的事件日志中,我看到了
22:00:28 Executing tasks: [:app:incrementalDevDebugSupportDex]
22:00:48 Gradle build finished in 20s 286ms
22:00:51 Instant Run applied code changes and restarted the current Activity.
Run Code Online (Sandbox Code Playgroud)
所以,我希望我能够从命令行运行该任务:./gradlew :app:incrementalDevDebugSupportDex.但是,没有找到:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'incrementalDevDebugSupportDex' not found in project ':app'.
Run Code Online (Sandbox Code Playgroud)
有没有办法从命令行运行Instant Run?
即时运行和Google地图似乎存在问题.在重新运行应用程序以查看更改时,如果应用程序正在使用Google地图,则会发生崩溃.这是堆栈跟踪的一部分:
java.lang.RuntimeException:
android.content.res.Resources$NotFoundException: File res/drawable/common_google_signin_btn_text_light_focused.xml from drawable resource ID
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
........
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/common_google_signin_btn_text_light_focused.xml from drawable resource ID
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2640)
.....
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/maps_btn_myl_pressed.png from drawable resource ID
Run Code Online (Sandbox Code Playgroud)
崩溃是因为a ResourcesNotFoundException而发生的,这似乎是由上面的堆栈跟踪中列出的文件引起的.
有没有人遇到过这个问题,如果有的话,解决了什么?
android google-maps android-studio instant-run android-instant-run
前提
由于我使用android studio 2.0(发行版),因此在编译我的应用程序时会得到许多内部类错误(这些似乎不相关,因为应用程序仍能正常工作).当我禁用即时运行时,我的应用程序工作正常,如果我启用它,应用程序崩溃
意见
编译时的错误如下:
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.samsung.android.sdk.pass.e) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it …Run Code Online (Sandbox Code Playgroud) 我刚安装了较新的Android Studio 2.2,在构建项目时遇到了麻烦:
Error:Execution failed for task ':app:processDebugAndroidTestResources'.
java.io.FileNotFoundException: [path_to_project]/app/build/intermediates/symbols/androidTest/debug/R.txt (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
我正在使用gradle版本2.14.1(因为这个版本的IDE强迫我使用它).
如果我禁用即时运行一切正常,但突然失去这个功能是一种耻辱.
有帮助吗?
编辑:
我尝试了以下但错误仍然发生:
android gradle android-studio instant-run android-studio-2.2
到目前为止,我很喜欢Android Studio 2.0的Instant Run功能.对于当前活动的小调整,它很棒.但是,有时我需要在之前的活动中进行调整,而Instant Run要么不应用该更改,要么可能只是不重新运行之前的活动.我希望能够将Instant Run作为一个快速选项,但有时只是想告诉AS重新加载完整的应用程序而不使用Instant Run.
有快速的方法吗?我在某个地方看到有一个三步检查清单 - 停止,重建,调试.但即使这似乎没有用,显然比按下单个按钮的旧方法慢.
启用即时运行时,是否没有简单的方法来更改我的部署目标?例如,我在我的mac上同时运行两个模拟器,一个是genymotion API 22,另一个是genymotion API 16.
我已经取消选中此框,因为我想将我的构建部署到我的api 16模拟器:
但是带有闪光灯的Play图标仍然出现在工具栏中,当我点击它时,它只是部署到我的genymotion API 22:
我必须进入首选项,然后搜索"即时运行",然后取消选中"启用即时运行"的框,然后才能将我的构建移动到API 16.
启用即时运行时,是否没有更简单的方法来更改部署目标?
Android Studio 2.1即时运行不会更新设备上的应用程序
我发现AndroidStudio 2.1存在问题.当我使用小的Java代码更改运行应用程序时,它有时不会更新设备上的应用程序.而是显示一条消息
无需更改部署//(不再显示)
我在这里错过任何东西吗?作为一种解决方法,我每次都要清理构建,以反映应用程序中的更改.
android android-studio instant-run android-instant-run android-studio-2.1
当我对布局资源文件进行更改时,当从Android Studio 2.0(预览3b)构建并安装apk文件时,它不会更新/反映.
示例:我有一个EditText,我添加了TextInputLayout这样的:
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_new_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edit_text_new_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_your_new_password"
android:inputType="textPassword"
android:saveEnabled="false" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
更新应用程序后的结果与我添加之前的结果相同TextInputLayout,只是EditText没有TextInputLayout.
我尝试过的:
我怀疑这可能是预览3b版本的Android Studio 2.0导致此问题的一个错误.有任何想法吗?也许它只是一个设置/配置?
当我运行我的应用程序时,它说
无法立即运行:Dalvik运行时的传统multi-dex
这是否意味着我在使用multi-dex时无法使用Instant Run?
我正在使用Android Studio beta4.
VerifyError当XpInsetDrawable.create(Drawable, int)达到(下面的代码)时抛出A. 不使用Instant Run 时不会发生这种情况.
我正在使用Android Studio 2.0.0和gradle build plugin 2.0.0.在SDK 22上测试.在SDK 19模拟器上运行时,整个模拟器重新启动.
我正在寻找除"禁用即时运行"之外的解决方案.
异常(整个堆栈跟踪无关)
Caused by: java.lang.VerifyError:
Verifier rejected class net.xpece.android.support.preference.XpInsetDrawable due to bad method
java.lang.Object net.xpece.android.support.preference.XpInsetDrawable.access$super(
net.xpece.android.support.preference.XpInsetDrawable,
java.lang.String,
java.lang.Object[])
(declaration of 'net.xpece.android.support.preference.XpInsetDrawable'
appears in /data/data/net.xpece.android.support.preference.sample/files/instant-run/dex/slice-slice_7-classe
Run Code Online (Sandbox Code Playgroud)
类源代码
final class XpInsetDrawable extends InsetDrawable {
private static final boolean NEEDS_FIXING = Build.VERSION.SDK_INT < 21;
private final Rect mInset = new Rect();
public static InsetDrawable create(final Drawable drawable, final int insetLeft, final int insetTop, final int insetRight, …Run Code Online (Sandbox Code Playgroud)