不以root用户身份运行时的Android Studio错误

时间:2017-01-17 11:11:08

标签: android linux

我正在尝试在Deepin OS上运行Android Studio。

当我以root身份运行Android Studio(sudo /opt/.studio.sh)时,它运行正常,但是当我尝试以另一个用户身份运行它时,它会出现此错误并在启动画面停止:

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0
Picked up _JAVA_OPTIONS:   -Dawt.useSystemAAFontSettings=gasp
Looking in classpath from com.intellij.util.lang.UrlClassLoader@6d5380c2 for /com/sun/jna/linux-x86-64/libjnidispatch.so
Found library resource at jar:file:/opt/android-studio/lib/jna.jar!/com/sun/jna/linux-x86-64/libjnidispatch.so
Trying /home/nilesh/.AndroidStudio2.2/system/tmp/jna5533482282299599001.tmp
Found jnidispatch at /home/nilesh/.AndroidStudio2.2/system/tmp/jna5533482282299599001.tmp
[   7839]  ERROR - llij.ide.plugins.PluginManager - tried to access method com.android.sdklib.AndroidVersion$AndroidVersionException.<init>(Ljava/lang/String;Ljava/lang/Throwable;)V from class com.android.sdklib.AndroidVersionHelper 
java.lang.IllegalAccessError: tried to access method com.android.sdklib.AndroidVersion$AndroidVersionException.<init>(Ljava/lang/String;Ljava/lang/Throwable;)V from class com.android.sdklib.AndroidVersionHelper
    at com.android.sdklib.AndroidVersionHelper.create(AndroidVersionHelper.java:71)
    at com.android.sdklib.repository.legacy.local.LocalSdk.scanPlatforms(LocalSdk.java:908)
    at com.android.sdklib.repository.legacy.local.LocalSdk.getPkgsInfos(LocalSdk.java:548)
    at com.android.sdklib.repository.legacy.LegacyLocalRepoLoader.parseLegacyLocalPackage(LegacyLocalRepoLoader.java:100)
    at com.android.repository.impl.manager.LocalRepoLoaderImpl.parsePackages(LocalRepoLoaderImpl.java:176)
    at com.android.repository.impl.manager.LocalRepoLoaderImpl.getPackages(LocalRepoLoaderImpl.java:154)
    at com.android.repository.impl.manager.RepoManagerImpl$LoadTask.run(RepoManagerImpl.java:653)
    at com.android.repository.api.RepoManager$DummyProgressRunner.runSyncWithProgress(RepoManager.java:398)
    at com.android.repository.impl.manager.RepoManagerImpl.load(RepoManagerImpl.java:387)
    at com.android.repository.api.RepoManager.loadSynchronously(RepoManager.java:290)
    at com.android.sdklib.repository.AndroidSdkHandler$RepoConfig.createRepoManager(AndroidSdkHandler.java:695)
    at com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:269)
    at com.android.sdklib.repository.AndroidSdkHandler.getLocalPackage(AndroidSdkHandler.java:326)
    at com.android.tools.idea.welcome.wizard.FirstRunWizard.init(FirstRunWizard.java:69)
    at com.android.tools.idea.welcome.wizard.FirstRunWizardHost.setupWizard(FirstRunWizardHost.java:99)
    at com.android.tools.idea.welcome.wizard.FirstRunWizardHost.getWelcomePanel(FirstRunWizardHost.java:91)
    at com.intellij.openapi.wm.impl.welcomeScreen.FlatWelcomeFrame.<init>(FlatWelcomeFrame.java:104)
    at com.intellij.openapi.wm.impl.welcomeScreen.FlatWelcomeFrameProvider.createFrame(FlatWelcomeFrameProvider.java:29)
    at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeFrame.showNow(WelcomeFrame.java:171)
    at com.intellij.idea.IdeaApplication$IdeStarter.main(IdeaApplication.java:340)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:200)
    at com.intellij.idea.MainImpl$1$1$1.run(MainImpl.java:52)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[   7855]  ERROR - llij.ide.plugins.PluginManager - Android Studio 2.2.3  Build #AI-145.3537739 
[   7855]  ERROR - llij.ide.plugins.PluginManager - JDK: 1.8.0_76-release 
[   7855]  ERROR - llij.ide.plugins.PluginManager - VM: OpenJDK 64-Bit Server VM 
[   7855]  ERROR - llij.ide.plugins.PluginManager - Vendor: JetBrains s.r.o 
[   7855]  ERROR - llij.ide.plugins.PluginManager - OS: Linux 
[   7856]  ERROR - llij.ide.plugins.PluginManager - Last Action:  
[   8104]  ERROR - plication.impl.ApplicationImpl - tried to access method com.android.sdklib.AndroidVersion$AndroidVersionException.<init>(Ljava/lang/String;Ljava/lang/Throwable;)V from class com.android.sdklib.AndroidVersionHelper 
java.lang.IllegalAccessError: tried to access method com.android.sdklib.AndroidVersion$AndroidVersionException.<init>(Ljava/lang/String;Ljava/lang/Throwable;)V from class com.android.sdklib.AndroidVersionHelper
    at com.android.sdklib.AndroidVersionHelper.create(AndroidVersionHelper.java:71)
    at com.android.sdklib.repository.legacy.local.LocalSdk.scanPlatforms(LocalSdk.java:908)
    at com.android.sdklib.repository.legacy.local.LocalSdk.getPkgsInfos(LocalSdk.java:548)
    at com.android.sdklib.repository.legacy.LegacyLocalRepoLoader.parseLegacyLocalPackage(LegacyLocalRepoLoader.java:100)
    at com.android.repository.impl.manager.LocalRepoLoaderImpl.parsePackages(LocalRepoLoaderImpl.java:176)
    at com.android.repository.impl.manager.LocalRepoLoaderImpl.getPackages(LocalRepoLoaderImpl.java:154)
    at com.android.repository.impl.manager.RepoManagerImpl$LoadTask.run(RepoManagerImpl.java:653)
    at com.android.repository.api.RepoManager$DummyProgressRunner.runSyncWithProgress(RepoManager.java:398)
    at com.android.repository.impl.manager.RepoManagerImpl.load(RepoManagerImpl.java:387)
    at com.android.repository.api.RepoManager.loadSynchronously(RepoManager.java:290)
    at com.android.sdklib.repository.AndroidSdkHandler$RepoConfig.createRepoManager(AndroidSdkHandler.java:695)
    at com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:269)
    at com.android.tools.idea.updater.SdkComponentSource.getRepoManager(SdkComponentSource.java:93)
    at com.android.tools.idea.updater.SdkComponentSource.initIfNecessary(SdkComponentSource.java:64)
    at com.android.tools.idea.updater.SdkComponentSource.getComponents(SdkComponentSource.java:140)
    at com.android.tools.idea.updater.SdkComponentSource.getAvailableVersions(SdkComponentSource.java:121)
    at com.intellij.openapi.updateSettings.impl.UpdateChecker.updateExternal(UpdateChecker.kt:355)
    at com.intellij.openapi.updateSettings.impl.UpdateChecker.doUpdateAndShowResult(UpdateChecker.kt:182)
    at com.intellij.openapi.updateSettings.impl.UpdateChecker.access$doUpdateAndShowResult(UpdateChecker.kt:76)
    at com.intellij.openapi.updateSettings.impl.UpdateChecker$updateAndShowResult$1.run(UpdateChecker.kt:112)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[   8119]  ERROR - plication.impl.ApplicationImpl - Android Studio 2.2.3  Build #AI-145.3537739 
[   8120]  ERROR - plication.impl.ApplicationImpl - JDK: 1.8.0_76-release 
[   8120]  ERROR - plication.impl.ApplicationImpl - VM: OpenJDK 64-Bit Server VM 
[   8120]  ERROR - plication.impl.ApplicationImpl - Vendor: JetBrains s.r.o 
[   8122]  ERROR - plication.impl.ApplicationImpl - OS: Linux 
[   8122]  ERROR - plication.impl.ApplicationImpl - Last Action:  

我是Android Studio新手并且在一段时间后返回Linux。我不确定以root用户身份运行Android Studio是个好主意。我该怎么办?

2 个答案:

答案 0 :(得分:0)

它只是一个警告说该选项已被忽略 - 所以它不会导致任何问题

JVM选项应位于 {IntelliJ文件夹} /bin/idea64.exe.vmoptions (在Windows上 - 可能类似于linux上的类似内容)。您可以编辑该文件并删除 maxpermsize 选项。

<强>步骤2:

如果在java 7中运行,请

设置 MaxPermSize 。该参数已在java 8中删除,因此将被忽略。

更多信息:What does -XX:MaxPermSize do?

答案 1 :(得分:0)

我通过完全删除Android Studio(通过删除〜/ .AndroidStudio~ / .Android等目录)解决了这个问题,并将其重新安装在〜/ android-studio目录中。

现在我可以作为非root用户运行AS。