在Android Studio中,我收到了IllegalStateException:没有为模块设置Android平台:

时间:2016-08-30 00:33:38

标签: android build.gradle android-studio-2.0

我正在尝试在我的Mac上运行在另一台Mac上创建的Android应用。

我不确定究竟是什么导致了这个问题,但如果您可以尝试帮助确定我需要修复的内容,请参阅以下信息。

这是出现的第一个错误:     IllegalStateException:没有为模块设置Android平台:

一分钟后我得到了这个:

RuntimeException: Unable to locate Android SDK used by project: 

这里我引用的是API版本24:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="net.learn2develop.Layouts"
    android:versionCode="440"
    android:versionName="440" >

    <uses-sdk android:minSdkVersion="24" />

位于此处: enter image description here

并在此处引用:

这也可能有所帮助:

Android platform not set for module: 
java.lang.IllegalStateException: Android platform not set for module: 
    at com.android.tools.idea.run.editor.DevicePicker.createChecker(DevicePicker.java:158)
    at com.android.tools.idea.run.editor.DevicePicker.<init>(DevicePicker.java:106)
    at com.android.tools.idea.run.editor.DeployTargetPickerDialog.<init>(DeployTargetPickerDialog.java:102)
    at com.android.tools.idea.run.editor.ShowChooserTargetProvider.showPrompt(ShowChooserTargetProvider.java:97)
    at com.android.tools.idea.run.AndroidRunConfigurationBase.getDeployTarget(AndroidRunConfigurationBase.java:659)
    at com.android.tools.idea.run.AndroidRunConfigurationBase.getState(AndroidRunConfigurationBase.java:360)
    at com.intellij.execution.runners.ExecutionEnvironment.getState(ExecutionEnvironment.java:158)
    at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:55)
    at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:31)
    at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:50)
    at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:31)
    at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:94)
    at com.intellij.execution.impl.ExecutionManagerImpl.start(ExecutionManagerImpl.java:114)
    at com.intellij.execution.impl.ExecutionManagerImpl.access$400(ExecutionManagerImpl.java:65)
    at com.intellij.execution.impl.ExecutionManagerImpl$7.run(ExecutionManagerImpl.java:503)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:337)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:321)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:866)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:381)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

如果我能展示其他内容,请告诉我。我尝试上传运行配置时遇到了重复错误。

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

在当前的mac机器上,android sdk的路径未定义或不可用。你必须给你的android工作室在你的mac机器上的sdk文件夹的路径。您可以从此链接获得一些帮助。 Android Studio - How to Change Android SDK Path