简体   繁体   English

Android Studio Run 按钮什么都不做

[英]Android Studio Run button does nothing

Upon creating a brand new android app;创建一个全新的 android 应用程序时; I click the run button, and it sits there and does absolutely nothing.我点击运行按钮,它就坐在那里,什么也不做。 I'm assuming an issue with Gradle possibly as the only thing remotely close to an error is the "Gradle Sync" warning me:我假设 Gradle 可能存在问题,因为唯一接近错误的地方是“Gradle Sync”警告我:

Warning:The project encoding (windows-1252) does not match the encoding specified in the Gradle build files (UTF-8).警告:项目编码 (windows-1252) 与 Gradle 构建文件 (UTF-8) 中指定的编码不匹配。 This can lead to serious bugs.这可能会导致严重的错误。

Would this preclude me from being able to do anything?这会妨碍我做任何事情吗? I've had an android app running on here before a few months ago with no issues like this, so I'm not even sure what to check.几个月前我在这里运行了一个 android 应用程序,没有出现这样的问题,所以我什至不确定要检查什么。

Possible Soluions:可能的解决方案:

  1. In AndroidStudio goto files->InvalidateCachesAndRestart在 AndroidStudio 中转到 files->InvalidateCachesAndRestart

  2. Try sync product with Gradle.尝试使用 Gradle 同步产品。

  3. Once the Run button is green with App selected.一旦“运行”按钮变为绿色并选择“应用程序”。 Then give Run然后给Run

To check if some background process is running on pressing the Run button, click on the GradleConsole on the bottom right corner of your Android Studio.要检查某些后台进程是否在按下 Run 按钮时正在运行,请单击 Android Studio 右下角的 GradleConsole。

I was facing the same issue (Click the run button and nothing happens).我遇到了同样的问题(单击运行按钮,没有任何反应)。 After digging into AndroidStuido I tried going to SDK Manager and installed the suggested install packages (shows in install button with 'Install (1) Package') .after installing that now I am able to run my app...深入研究 AndroidStuido 后,我尝试转到 SDK Manager 并安装了建议的安装包(显示在带有“安装 (1) 包”的安装按钮中)。安装后,现在我可以运行我的应用程序了...

I think some SDK was not up to date or might not installed properly.我认为某些 SDK 不是最新的或者可能没有正确安装。

Try close and reopen the Android Studio once.尝试关闭并重新打开 Android Studio 一次。 It worked for me I don't know how它对我有用,我不知道如何

I had the same issue.我遇到过同样的问题。 I had to delete the virtual device and recreate it in the Studio.我不得不删除虚拟设备并在 Studio 中重新创建它。 Somehow the device itself (or the control software in there) had confused itself.不知何故,设备本身(或那里的控制软件)已经混淆了自己。

If the run button is grey then there was probably an error in last gradle build or compilation. 如果运行按钮是灰色的,那么在上一个gradle构建或编译中可能存在错误。 If it is green than click on the drop down button/spinner on left side of run button on which the name of your app is present. 如果是绿色,则单击运行按钮左侧的下拉按钮/微调器,其中存在应用程序的名称。 If there is cross on this button then there was probably an error in last gradle build or compilation. 如果此按钮上有交叉,则最后一次gradle构建或编译可能存在错误。 otherwise click on "Edit Run Configurations" and check the "Launch Default Activity" button and hit Apply. 否则单击“编辑运行配置”并选中“启动默认活动”按钮,然后单击“应用”。 your project should run now. 你的项目现在应该运行。

Since I couldn't figure out what setting to change, a simple and complete uninstall and reinstall seems to have fixed it.由于我不知道要更改什么设置,因此简单而完整的卸载和重新安装似乎已修复它。 >.> >.>

I also into trap of this green RUN button in Android studio.我也陷入了 Android Studio 中这个绿色 RUN 按钮的陷阱。 Whenever I clicked it and select device for ADB , it is doing nothing.每当我点击它并为 ADB 选择设备时,它什么都不做。 On checking Gradle event log tab in Android Studio(at bottom right corner , in left of gradle console tab), error was EmptyThrowable: Runner Run is not registered .在 Android Studio 中检查 Gradle 事件日志选项卡(在右下角,在 gradle 控制台选项卡左侧)时,错误为EmptyThrowable: Runner Run is not registered How I solve it temporarily: Use Debug App option on right of RUN button(shift + F9).我如何临时解决它:使用 RUN 按钮右侧的 Debug App 选项(shift + F9)。 It did start the build process and I saved my time.它确实开始了构建过程,我节省了时间。

Or you can check your adb cosole for logs places in bottom right corner of Android Studio.或者您可以在 Android Studio 的右下角检查您的 adb cosole 中的日志位置。 If it says missing adb location in sdk, try to lauch sdk manager and update platfor-tools for latest version.如果它说 sdk 中缺少 adb 位置,请尝试启动 sdk 管理器并更新 platfor-tools 以获取最新版本。 This will fix missing adb file in sdk.这将修复 sdk 中丢失的 adb 文件。

1.Go to location in C:\\Program files\\Android\\Android Studio\\bin\\idea.properties 1.转到C:\\Program files\\Android\\Android Studio\\bin\\idea.properties 中的位置

2.Open the idea.properties file via any text editor 2.通过任何文本编辑器打开idea.properties文件

3.Add the following code to disable.android.first.run=true 3.在disable.android.first.run=true加入如下代码

4.Save as file on desktop 4.另存为桌面文件

5.Go to the C:\\Program files\\Android\\Android Studio\\bin 5.转到C:\\Program files\\Android\\Android Studio\\bin

6.Paste the file which we save as on desktop 6.粘贴我们保存在桌面上的文件

7.Now replace idea.propeties file. 7.现在替换idea.propeties文件。

Done...!完毕...!

close the android studio..关闭安卓工作室..

Open this link...打开这个链接...

https://developer.android.com/studio/releases/platform-tools.html#tos-header https://developer.android.com/studio/releases/platform-tools.html#tos-header

and download platform-tools extracted it并下载平台工具解压缩它

and then paste these platform form tools into然后将这些平台表格工具粘贴到

C:\\Users\\Faisal\\AppData\\Local\\Android\\Sdk\\ C:\\Users\\Faisal\\AppData\\Local\\Android\\Sdk\\

replace existing tools with new one用新工具替换现有工具

open the android studio now it work fine...现在打开android studio它工作正常......

If you recently cleared your settings cache, you may need to reset your Run/Debug Configurations:如果您最近清除了设置缓存,则可能需要重置运行/调试配置:

Run > Edit Configurations > Android App > app (from left menu) >运行 > 编辑配置 > Android 应用程序 > 应用程序(从左侧菜单)>

Deployment Target Options: Target Emulator部署目标选项:目标模拟器

Preferred Android Virtual Device: < emulator target you created, eg Pixel 2 API 28>首选 Android 虚拟设备:<您创建的模拟器目标,例如 Pixel 2 API 28>

从菜单中选择运行/调试配置

选择配置

In my case it was "not enough space" issue.就我而言,这是“空间不足”的问题。 Required 7GB of free space on C: and I had only 3 C: 上需要 7GB 的可用空间,而我只有 3 个

For me, it was because I did not have VT-x / Intel Virtualization Technology enabled in my BIOS.对我来说,这是因为我的 BIOS 中没有启用 VT-x / Intel 虚拟化技术。 Flipping that after a machine restart and trying to run in Android Studio again worked.在机器重新启动并尝试再次在 Android Studio 中运行后翻转它。

I solved this issue by doing Help->CheckForUpdates about 4 times (I did not install the beta).我通过执行 Help->CheckForUpdates 大约 4 次解决了这个问题(我没有安装测试版)。 Which required a couple downloads and a couple restarts.这需要几次下载和几次重新启动。

In my case,run button was visible in green color but nothing happened on clicking it在我的情况下,运行按钮以绿色可见,但单击它时没有任何反应

I opened another project and it worked there normally我打开了另一个项目,它在那里正常工作

All was working fine,I could install build apks smoothly and suddenly this issue occured一切正常,我可以顺利安装构建 apk,突然出现这个问题

Sync Project with Gradle Files/Sync/Rebuild/Make/Restart/End task nothing worked使用 Gradle Files/Sync/Rebuild/Make/Restart/End 任务同步项目没有任何效果

Even copied project to another project but same issue甚至将项目复制到另一个项目但同样的问题

Invented a quick hack for temporory basis发明了一个临时的快速黑客

在此处输入图片说明

Just go to Build Tab > find the installDebug task and click to run it只需转到 Build Tab > 找到 installDebug 任务并单击以运行它

The app will be built and installed该应用程序将被构建和安装

Just launch manually from launcher只需从启动器手动启动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM