未为模块指定 Android APK 路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21281445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android APK path is not specified for module
提问by Sergey Shustikov
I have a problem. When i try to launch my project i've got error :
我有个问题。当我尝试启动我的项目时出现错误:
"ERROR: APK path is not specified for module"
I follow to this answer APK path is not specified for module "Example-Example"but that no give me result. Any more ideas?
我遵循这个答案APK 路径没有为模块“Example-Example”指定,但没有给我结果。还有更多想法吗?
回答by Sergey Shustikov
Finally I founded a solution.
最后我找到了一个解决方案。
- Open Project structure
- Click on Modulestab
- Expand your project and click on Android
- On right side click on Packagingtab (Compileron older versions of Android Studio)
- Looking for "APK path"field
- Click on ...and choose your project root folder(that contains bin/,gen/,res/folders
- Copy path into your clipboard
- Close choose path dialog
- Paste copied path into APK path field.
- Add to path text \bin
- Click Applyand Ok
- 开放项目结构
- 单击模块选项卡
- 展开您的项目并单击Android
- 在右侧单击Packaging选项卡(旧版 Android Studio 上的Compiler)
- 寻找“APK路径”字段
- 单击...并选择您的项目根文件夹(包含bin/,gen/,res/文件夹
- 将路径复制到剪贴板
- 关闭选择路径对话框
- 将复制的路径粘贴到 APK 路径字段中。
- 添加到路径文本\bin
- 单击Apply并Ok
In the end you must have a path :
最后你必须有一个路径:
D:\<path to your project root>\bin
D:\<path to your project root>\bin
Try to build your project.
尝试构建您的项目。
may be it helps for someone ...
可能对某人有帮助......
Note : For Android Studio use thisanswer.
注意:对于 Android Studio,请使用此答案。
回答by MikeL
Could not use the accepted answer in my Android Studio (0.6.1) because I couldn't find the "Compiler" tab. I suppose that this structure is for Intelij. Nevertheless, it pointed me to the right solution:
无法在我的 Android Studio (0.6.1) 中使用已接受的答案,因为我找不到“编译器”选项卡。我想这个结构是用于 Intelij 的。尽管如此,它为我指出了正确的解决方案:
My Project included some LIB modules besides the main APK module and by setting all modules to use the same Compiler output directory fixed the error. In order to do so you just need to follow these steps:
除了主 APK 模块之外,我的项目还包括一些 LIB 模块,并通过将所有模块设置为使用相同的编译器输出目录来修复错误。为此,您只需执行以下步骤:
- Open Project structure(F4 on one of the modules in the project explorer)
- Click on Projecttab on the left
- Define "Project compiler output:"as YOUR_PROJECT_PATH\out (or any folder you want)
- Click on Modulestab on the left
- Go over all your modules and verify that under the Pathstab the Compiler output is set to "Inherit project compile output path"
- Thats it...
- 打开项目结构(在项目资源管理器中的模块之一上按 F4)
- 单击左侧的项目选项卡
- 将“项目编译器输出:”定义为YOUR_PROJECT_PATH\out(或您想要的任何文件夹)
- 单击左侧的模块选项卡
- 检查所有模块并验证在“路径”选项卡下,编译器输出设置为“继承项目编译输出路径”
- 就是这样...
回答by Brent Faust
Another reason could be that the Output Directory is not set to a valid directory. Note that relative paths are not supported, at least in IntelliJ 14.
另一个原因可能是输出目录未设置为有效目录。请注意,不支持相对路径,至少在 IntelliJ 14 中是这样。
Project Structure (Cmd-;) > Modules > Paths:
项目结构 (Cmd-;) > 模块 > 路径:
Set Compiler output to "Use module compile output path", then choose/create the desired output directory for the APK.
将编译器输出设置为“使用模块编译输出路径”,然后为 APK 选择/创建所需的输出目录。
回答by peterk
Note - I had same issue here, It seems intellij caches a lot of stuff. All my settings were right in the UI but I had renamed the .iml file using the refactor feature because of a spelling error. it left a dangling reference to the old module spelling in the .idea/modules file with along with the new one it created and did not update the build path (cached?) I had to invalidate the caches, hand edit the ,idea/modules.xml file to delete the entries ( all of them to be safe with intellij closed ) then restarted intellij and re-imported the .iml files.
注意 - 我在这里遇到了同样的问题,似乎 intellij 缓存了很多东西。我的所有设置都在 UI 中正确,但由于拼写错误,我使用重构功能重命名了 .iml 文件。它在 .idea/modules 文件中留下了对旧模块拼写的悬空引用以及它创建的新模块,并且没有更新构建路径(缓存?)我不得不使缓存无效,手动编辑 ,idea/modules .xml 文件删除条目(所有这些条目都是安全的,intellij 关闭)然后重新启动 intellij 并重新导入 .iml 文件。
I also re-booted the android device.
我还重新启动了 android 设备。
Probably overkill but this solved the problem in my case.
可能矫枉过正,但这解决了我的问题。
回答by ?ukasz W?ódarczyk
If you are running a 64-bit distribution on your development machine, you need to install additional packages first. For Ubuntu 13.10(Saucy Salamander) and above, install the libncurses5:i386, libstdc++6:i386, and zlib1g:i386 packages using apt-get:
如果您在开发机器上运行 64 位发行版,则需要先安装其他软件包。对于Ubuntu 13.10(Saucy Salamander) 及更高版本,使用 apt-get 安装 libncurses5:i386、libstdc++6:i386 和 zlib1g:i386 包:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
For earlierversions of Ubuntu, install the ia32-libs package using apt-get:
对于早期版本的 Ubuntu,使用 apt-get 安装 ia32-libs 包:
apt-get install ia32-libs