Android Studio打开项目无法运行(run/Add Configuration)

问题描述

项目构建成功,没有错误,但是 Run 按钮是灰色,并提示 Add Configuration

几种解决方法

  1. 做一次Gradle同步

    File -> Sync Project with Gradle Files

  2. 检查模块是否设置为application

    打开Modulebuild.gradle查看是否有以下内容:

    apply plugin: 'com.android.application'
    
  3. 检查CompileSdkVersion的设置

    查看Modulebuild.gradleCompileSdkVersion版本在本地的SDK中是否存在

    如果没有请在File -> Settings.. -> Apprearance & Behavior -> System Settings -> Android SDK -> SDK Platforms中下载对应的版本

    或者修改CompileSdkVersion为本地SDK中已存在的版本

  4. 查看是否启用了对应的模块

    查看项目(根目录的setting.gradle)是否导入了对应的模块(app可能不是你实际使用的模块名,请自行修改):

    include ':app'
    
  5. Gradle版本太低

    1. 手动升级Gradle版本

      File -> Project Structure... -> Project,升级Android Gradle Plugin VersionGradle Version。Plugin和Gradle的版本要保持对应,对应关系查看这里:

      Android Gradle Plugin Version版本 与 Gradle Version版本的对应关系

    2. 不升级Gradle(需要使用旧版本)

      手动添加Google仓库,打开根目录build.gradle

      buildscript {
         repositories {
         		// 这里
         		// 或者使用 goole(),选一个有用的即可
             maven { url 'https://dl.google.com/dl/android/maven2/' }
             jcenter()
         }
      }
      ...
      allprojects {
          repositories {
          	// 这里
              maven { url 'https://dl.google.com/dl/android/maven2/' }
              jcenter()
          }
      }
      ...
      
  • 18
    点赞
  • 94
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Installation notes The following compilers are supported by the AlphaControls: Delphi 5/6/7 Delphi 2005/2006/2007/2009/2010/XE/XE2/XE3 (x32/x64) C++ Builder 6/2006/2007/2009/2010/XE/XE2/XE3 -------------------------------------------------------------------------------- If you have a previous version of the AlphaControls installed, you must remove it completely before installing this version. To remove a previous installation, proceed as follows. To remove the AlphaControls: 1. Close the IDE 2. Browse to the folder where your bpl and dcp files are located (default is $(DELPHI)\Projects\Bpl for Delphi, $(BCB)\Projects\Bpl for C++ Builder). 3. Delete all of the files related to AlphaControls (acnt*.*) -------------------------------------------------------------------------------- Install of 32bit packages for Delphi : 1. Start by unpacking the acnt*.zip files into a folder of your own choice. 2. This directory must be registered in system search path. And add, (if need) AlphaControls directory in Delphi (Tools->Environment Options->Library->Library Path). 3. Use "File\Open..." menu item of Delphi IDE to open the AlphaControls run-time package acntX_r.dpk (x - version of Delphi). In the "Package..." window click "Compile" button to compile run-time library. 4. Use "File\Open..." menu item of Delphi IDE to open the AlphaControls design-time package acntX.dpk. In the "Package..." window click "Install" button ("Install menu item for latest versions of IDE") to install the library. 5. DB-aware components users can install AlphaDB pack by copying AlphaDB files to AlphaControls directory and AlphaDB.dpk file installing. Install for C++ Builder : 1. Start by unpacking the acnt*.zip files into a folder of your own choice. 2. This directory must be registered in system search path. And add (if need) AlphaControls directory in C++ Builder paths and projects Include & Library paths. 3. Open acnt*_R.bpk file or acnt*_R.cbproj (for RAD studio). In RAD studio open Project/Options/Paths and check this page, "Intermediate output" option must be empty! 4. Compile it ("Make", not "Build"!) and save all. 5. Open acnt*.bpk or acnt*.cbproj (for RAD studio) file and Install, it and save all. In RAD studio open Project/Options/Paths and check this page, "Intermediate output" option must be empty! Using 64bit packages under Delphi XE2/XE3 : 1. Install 32bit package in the IDE. 2. Configure an application options, define a path to 64bit units for "Win64 platform" configuration. 32bit units should be used in design-time, 64bit units should be used in run-time for an application building for Win64 platform.
https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#step-2-use Step 1: Install First, we need to know what name SQLite goes by in the ports tree. To do that, we'll run the search command and inspect the output: PS D:\src\vcpkg> .\vcpkg search sqlite libodb-sqlite 2.4.0 Sqlite support for the ODB ORM library sqlite3 3.15.0 SQLite is a software library that implements a se... If your library is not listed, please open an issue at: https://github.com/Microsoft/vcpkg/issues Looking at the list, we can see that the port is named "sqlite3". You can also run the search command without arguments to see the full list of packages. Installing is then as simple as using the install command. PS D:\src\vcpkg> .\vcpkg install sqlite3 -- CURRENT_INSTALLED_DIR=D:/src/vcpkg/installed/x86-windows -- DOWNLOADS=D:/src/vcpkg/downloads -- CURRENT_PACKAGES_DIR=D:/src/vcpkg/packages/sqlite3_x86-windows -- CURRENT_BUILDTREES_DIR=D:/src/vcpkg/buildtrees/sqlite3 -- CURRENT_PORT_DIR=D:/src/vcpkg/ports/sqlite3/. -- Downloading https://sqlite.org/2016/sqlite-amalgamation-3150000.zip... -- Downloading https://sqlite.org/2016/sqlite-amalgamation-3150000.zip... OK -- Testing integrity of downloaded file... -- Testing integrity of downloaded file... OK -- Extracting source D:/src/vcpkg/downloads/sqlite-amalgamation-3150000.zip -- Extracting done -- Configuring x86-windows-rel -- Configuring x86-windows-rel done -- Configuring x86-windows-dbg -- Configuring x86-windows-dbg done -- Build x86-windows-rel -- Build x86-windows-rel done -- Build x86-windows-dbg -- Build x86-windows-dbg done -- Package x86-windows-rel -- Package x86-windows-rel done -- Package x86-windows-dbg -- Package x86-windows-dbg done -- Performing post-build validation -- Performing post-build validation done Package sqlite3:x86-windows is installed We can check that sqlite3 was successfully installed
### 回答1: 在 Android Studio 中添加配置需要在 "Run/Debug Configurations" 面板中进行操作。 1. 打开 "Run/Debug Configurations" 面板,可以通过点击菜单栏 "Run" > "Edit Configurations" 或者通过点击左下角的 "Add Configuration" 按钮打开。 2. 点击 "Add New Configuration" 按钮或者 "+" 按钮,选择需要添加的配置类型,如 "Android App"。 3. 输入配置的名称,选择对应的模拟器或者设备,并设置其它相关参数。 4. 点击 "Apply" 或 "OK" 按钮保存配置。 5. 在 "Run/Debug Configurations" 面板中可以看到新添加的配置,可以在此面板中进行编辑和删除操作。 ### 回答2: Android Studio是具有编写Android应用程序所需的所有工具、集成开发环境和函数的IDE。在Android Studio中,可以通过添加配置来实现对应用程序的设置和管理。 添加配置的过程可能因配置类型和用途而异,但一般包含以下步骤: 1. 打开Android Studio。首先需要打开Android Studio,进入项目界面。 2. 找到“Edit Configurations”。在Android Studio窗口的左侧栏中找到“Run”或“Debug”按钮,单击该按钮旁边的下拉箭头,然后单击“Edit Configurations”。 3. 添加配置。在“Edit Configurations”窗口中,单击左上方的“+”按钮,选择要添加的配置类型,如“Android App”、“JUnit”、“Gradle”等等。根据需要,可以设置配置的各种属性,例如应用程序的名称、启动方式、运行时选项等。 4. 应用配置。完成配置设置后,单击“OK”按钮以保存和应用新的配置。如果有多个配置,可以使用下拉菜单在运行或调试应用程序时轻松地在它们之间切换。 总之,添加配置是Android Studio中一个非常重要的功能,可以帮助开发者更好地管理和设置他们的应用程序。我们需要仔细了解每个配置类型的用途和设置方法,并适时地将它们添加到我们的项目中,以便更好地管理我们的应用程序。 ### 回答3: Android Studio(下称AS)的configure指的是添加一些额外的设置或插件来改善开发体验,这里简单介绍如何进行configure。 首先,打开你的Android Studio并进入File>Settings(或选择Preferences on mac)。这里你可以看到很多选项,例如Build, Execution, Deployment、Appearance & Behavior、Editor等等,这些选项能帮助你定制化AS的界面和功能。 对于新手来说,可能最感兴趣的是Plugins,这里可以添加许多有用的插件,让开发更加高效。点击Plugins,可以看到顶部有一个Marketplace的选项,点击进去可以搜索并安装许多第三方插件,例如Kotlin、Flutter、React Native等的支持插件,还有很多调试和测试插件。在搜索插件之后,点击下载并安装即可。 另外一个常用的configure是SDK Manager。在设置界面的左侧,可以看到SDK Manager,这里可以添加或删除你所需的Android SDK。比如你需要在你的应用中使用Android 9.0 Pie SDK来编写代码,那么你需要在SDK Platforms中下载该SDK。如果你想添加特定的库或工具,你可以点击SDK Tools,找到并勾选你所需的工具。这使得你可以更加方便地开发你的应用。 AS还有很多其他的configure,需要根据你的开发需求进行选择。希望上述资料对你有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值