Android Studio不适用于Oracle JDK 1.8

时间:2017-01-14 17:42:02

标签: android android-studio java-8 gentoo

我的Gentoo上有几个版本的Java:

$ java-config --list-available-vms
The following VMs are available for generation-2:
1)  IcedTea JDK 7.2.6.7 [icedtea-bin-7]
2)  IcedTea JDK 3.1.0 [icedtea-bin-8]
3)  Oracle JDK 1.8.0.112 [oracle-jdk-bin-1.8]

当我有这样的设置时,我的Android Studio甚至没有启动。显示这些消息:

android-studio 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0
Looking in classpath from com.intellij.util.lang.UrlClassLoader@736e9adb 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/user/.AndroidStudio2.2/system/tmp/jna6767094858258384499.tmp
Found jnidispatch at /home/user/.AndroidStudio2.2/system/tmp/jna6767094858258384499.tmp
[    277]  ERROR - llij.ide.plugins.PluginManager - sun.font.FreetypeFontScaler.initIDs(Ljava/lang/Class;)V 
java.lang.UnsatisfiedLinkError: sun.font.FreetypeFontScaler.initIDs(Ljava/lang/Class;)V
    at sun.font.FreetypeFontScaler.initIDs(Native Method)
    at sun.font.FreetypeFontScaler.<clinit>(FreetypeFontScaler.java:50)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at sun.font.FontScaler.<clinit>(FontScaler.java:98)
    at sun.font.TrueTypeFont.getScaler(TrueTypeFont.java:1298)
    at sun.font.FileFontStrike.<init>(FileFontStrike.java:179)
    at sun.font.FileFont.createStrike(FileFont.java:95)
    at sun.font.Font2D.getStrike(Font2D.java:359)
    at sun.font.Font2D.getStrike(Font2D.java:308)
    at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:78)
    at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:93)
    at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:359)
    at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:350)
    at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:302)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1113)
    at javax.swing.JComponent.getFontMetrics(JComponent.java:1626)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:372)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:345)
    at javax.swing.plaf.basic.BasicLabelUI.paint(BasicLabelUI.java:163)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
    at javax.swing.JComponent.paintComponent(JComponent.java:780)
    at com.intellij.ui.Splash$1.paintComponent(Splash.java:78)
    at javax.swing.JComponent.paint(JComponent.java:1056)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5217)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1579)
    at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1502)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
    at javax.swing.JComponent.paint(JComponent.java:1042)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:79)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:116)
    at java.awt.Container.paint(Container.java:1975)
    at java.awt.Window.paint(Window.java:3904)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:842)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:814)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
    at javax.swing.RepaintManager.access$1200(RepaintManager.java:64)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1732)
    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:80)
    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)
[    282]  ERROR - llij.ide.plugins.PluginManager - Android Studio 2.2.2  Build #AI-145.3360264 
[    282]  ERROR - llij.ide.plugins.PluginManager - JDK: 1.8.0_112 
[    282]  ERROR - llij.ide.plugins.PluginManager - VM: Java HotSpot(TM) 64-Bit Server VM 
[    282]  ERROR - llij.ide.plugins.PluginManager - Vendor: Oracle Corporation 
[    282]  ERROR - llij.ide.plugins.PluginManager - OS: Linux 

Start Failed: Internal Error. Please report to https://code.google.com/p/android/issues

java.lang.UnsatisfiedLinkError: sun.font.FreetypeFontScaler.initIDs(Ljava/lang/Class;)V
    at sun.font.FreetypeFontScaler.initIDs(Native Method)
    at sun.font.FreetypeFontScaler.<clinit>(FreetypeFontScaler.java:50)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at sun.font.FontScaler.<clinit>(FontScaler.java:98)
    at sun.font.TrueTypeFont.getScaler(TrueTypeFont.java:1298)
    at sun.font.FileFontStrike.<init>(FileFontStrike.java:179)
    at sun.font.FileFont.createStrike(FileFont.java:95)
    at sun.font.Font2D.getStrike(Font2D.java:359)
    at sun.font.Font2D.getStrike(Font2D.java:308)
    at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:78)
    at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:93)
    at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:359)
    at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:350)
    at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:302)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1113)
    at javax.swing.JComponent.getFontMetrics(JComponent.java:1626)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:372)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:345)
    at javax.swing.plaf.basic.BasicLabelUI.paint(BasicLabelUI.java:163)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
    at javax.swing.JComponent.paintComponent(JComponent.java:780)
    at com.intellij.ui.Splash$1.paintComponent(Splash.java:78)
    at javax.swing.JComponent.paint(JComponent.java:1056)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5217)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1579)
    at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1502)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
    at javax.swing.JComponent.paint(JComponent.java:1042)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:79)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:116)
    at java.awt.Container.paint(Container.java:1975)
    at java.awt.Window.paint(Window.java:3904)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:842)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:814)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
    at javax.swing.RepaintManager.access$1200(RepaintManager.java:64)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1732)
    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:80)
    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)


Also, an UI exception occurred on attempt to show above message:
java.lang.NoClassDefFoundError: Could not initialize class sun.font.FontScaler
    at sun.font.TrueTypeFont.getScaler(TrueTypeFont.java:1298)
    at sun.font.FileFontStrike.<init>(FileFontStrike.java:179)
    at sun.font.FileFont.createStrike(FileFont.java:95)
    at sun.font.Font2D.getStrike(Font2D.java:359)
    at sun.font.Font2D.getStrike(Font2D.java:308)
    at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:78)
    at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:93)
    at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:359)
    at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:350)
    at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:302)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1113)
    at javax.swing.JComponent.getFontMetrics(JComponent.java:1626)
    at javax.swing.text.GlyphPainter1.sync(GlyphPainter1.java:226)
    at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:59)
    at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:592)
    at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:732)
    at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:233)
    at javax.swing.text.ParagraphView.calculateMinorAxisRequirements(ParagraphView.java:717)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:935)
    at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:568)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:903)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:935)
    at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:343)
    at javax.swing.text.BoxView.layout(BoxView.java:708)
    at javax.swing.text.BoxView.setSize(BoxView.java:397)
    at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1722)
    at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:917)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1662)
    at javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1333)
    at javax.swing.text.JTextComponent.getPreferredScrollableViewportSize(JTextComponent.java:1937)
    at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:93)
    at java.awt.Container.preferredSize(Container.java:1796)
    at java.awt.Container.getPreferredSize(Container.java:1780)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1664)
    at javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:492)
    at java.awt.Container.preferredSize(Container.java:1796)
    at java.awt.Container.getPreferredSize(Container.java:1780)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1664)
    at com.intellij.idea.Main.showMessage(Main.java:370)
    at com.intellij.idea.Main.showMessage(Main.java:335)
    at com.intellij.idea.Main.showMessage(Main.java:314)
    at com.intellij.ide.plugins.PluginManager.processException(PluginManager.java:141)
    at com.intellij.ide.IdeEventQueue.processException(IdeEventQueue.java:407)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:369)
    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)

仅适用于IcedTea版本。

但是当我尝试在IcedTea Java中使用lambda表达式时,我收到一条错误消息:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

为了允许JDK 1.8我添加到Gradle:

compileOptions {
        sourceCompatibility 1.8
    }

有人可以帮我处理这个Android Studio配置吗?

2 个答案:

答案 0 :(得分:0)

您是否已将JAVA_HOME环境变量设置为

C:\Program Files\Java\jdkX.XX

其中,X.XX是JDK的版本号

另外,请删除sourceCompatibility 1.8。然后,清理并构建项目。

答案 1 :(得分:0)

我不确定,但似乎在安装oracle-jre-1.8之后一切都还可以。好像IcedTea JRE和Oracle JDK之间存在冲突。