Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio sun.font.CompositeFont cannot be cast to sun.font.PhysicalFont

I keep getting this error when trying to run Android Studio 2.2.3 on two different Ubuntu Computers. One running 14.04 Trusty and the other 16.04 Xenial.

It runs the splash screen, the loading bar gets to the end, and then it sits there and this error is shown in the console.

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0 
Looking in classpath from com.intellij.util.lang.UrlClassLoader@2077d4de for /com/sun/jna/linux-x86-64/libjnidispatch.so 
Found library resource at jar:file:/home/me/Downloads/android-studio/lib/jna.jar!/com/sun/jna/linux-x86-64/libjnidispatch.so 
Trying /home/me/.AndroidStudio2.2/system/tmp/jna3820816485682346846.tmp 
Found jnidispatch at /home/me/.AndroidStudio2.2/system/tmp/jna3820816485682346846.tmp 
[   9485]   WARN - dea.updater.SdkComponentSource - File /home/me/.android/repositories.cfg could not be loaded.  
[   9618]   WARN - s.RepoProgressIndicatorAdapter - File /home/me/.android/repositories.cfg could not be loaded.  
[   9994]  ERROR - llij.ide.plugins.PluginManager - java.lang.ClassCastException: sun.font.CompositeFont cannot be cast to sun.font.PhysicalFont  
java.lang.RuntimeException: java.lang.ClassCastException: sun.font.CompositeFont cannot be cast to sun.font.PhysicalFont 
       at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:204) 
       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) 
Caused by: java.lang.ClassCastException: sun.font.CompositeFont cannot be cast to sun.font.PhysicalFont 
       at sun.font.CompositeFont.doDeferredInitialisation(CompositeFont.java:293) 
       at sun.font.CompositeFont.getSlotFont(CompositeFont.java:360) 
       at sun.font.CompositeGlyphMapper.getSlotMapper(CompositeGlyphMapper.java:114) 
       at sun.font.CompositeGlyphMapper.convertToGlyph(CompositeGlyphMapper.java:124) 
       at sun.font.CompositeGlyphMapper.charToGlyph(CompositeGlyphMapper.java:162) 
       at sun.font.CompositeStrike.getCodePointAdvance(CompositeStrike.java:158) 
       at sun.font.FontDesignMetrics.handleCharWidth(FontDesignMetrics.java:416) 
       at sun.font.FontDesignMetrics.getLatinCharWidth(FontDesignMetrics.java:425) 
       at sun.font.FontDesignMetrics.stringWidth(FontDesignMetrics.java:476) 
       at sun.swing.SwingUtilities2.stringWidth(SwingUtilities2.java:403) 
       at javax.swing.SwingUtilities.layoutCompoundLabelImpl(SwingUtilities.java:1005) 
       at javax.swing.SwingUtilities.layoutCompoundLabel(SwingUtilities.java:890) 
       at javax.swing.plaf.basic.BasicGraphicsUtils.getPreferredButtonSize(BasicGraphicsUtils.java:282) 
       at javax.swing.plaf.basic.BasicButtonUI.getPreferredSize(BasicButtonUI.java:376) 
       at javax.swing.plaf.basic.BasicButtonUI.getMinimumSize(BasicButtonUI.java:366) 
       at javax.swing.JComponent.getMinimumSize(JComponent.java:1744) 
       at java.awt.GridLayout.minimumLayoutSize(GridLayout.java:390) 
       at java.awt.Container.minimumSize(Container.java:1848) 
       at java.awt.Container.getMinimumSize(Container.java:1832) 
       at javax.swing.JComponent.getMinimumSize(JComponent.java:1746) 
       at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:1117) 
       at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:916) 
       at java.awt.GridBagLayout.minimumLayoutSize(GridBagLayout.java:750) 
       at java.awt.Container.minimumSize(Container.java:1848) 
       at java.awt.Container.getMinimumSize(Container.java:1832) 
       at javax.swing.JComponent.getMinimumSize(JComponent.java:1746) 
       at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:663) 
       at java.awt.Container.minimumSize(Container.java:1848) 
       at java.awt.Container.getMinimumSize(Container.java:1832) 
       at javax.swing.JComponent.getMinimumSize(JComponent.java:1746) 
       at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:673) 
       at java.awt.Container.minimumSize(Container.java:1848) 
       at java.awt.Container.getMinimumSize(Container.java:1832) 
       at javax.swing.JComponent.getMinimumSize(JComponent.java:1746) 
       at javax.swing.JRootPane$RootLayout.minimumLayoutSize(JRootPane.java:944) 
       at java.awt.Container.minimumSize(Container.java:1848) 
       at java.awt.Container.getMinimumSize(Container.java:1832) 
       at javax.swing.JComponent.getMinimumSize(JComponent.java:1746) 
       at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:663) 
       at java.awt.Container.minimumSize(Container.java:1848) 
       at java.awt.Container.getMinimumSize(Container.java:1832) 
       at com.intellij.openapi.wm.impl.welcomeScreen.FlatWelcomeFrame.<init>(FlatWelcomeFrame.java:109) 
       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) 
       ... 16 more 
[   9998]  ERROR - llij.ide.plugins.PluginManager - Android Studio 2.2.3  Build #AI-145.3537739  
[   9998]  ERROR - llij.ide.plugins.PluginManager - JDK: 1.8.0_76-release  
[   9998]  ERROR - llij.ide.plugins.PluginManager - VM: OpenJDK 64-Bit Server VM  
[   9998]  ERROR - llij.ide.plugins.PluginManager - Vendor: JetBrains s.r.o  
[   9998]  ERROR - llij.ide.plugins.PluginManager - OS: Linux  
[   9999]  ERROR - llij.ide.plugins.PluginManager - Last Action:   
^C[  13652]   WARN - pl.local.NativeFileWatcherImpl - Watcher terminated with exit code 130 
like image 496
mouckatron Avatar asked Dec 22 '16 11:12

mouckatron


1 Answers

Firstly, thank you to those who commented on the question, your input solved my problem. I just wanted to add a proper answer.

As found in the several track links in the question comments, the problem seems to be related to the Helvetica font file from a Mac. From the link:

The problem is a bad font: /usr/share/fonts/TTF/Helvetica.ttf

It was copied from OS X machine and is attached.

When the font is removed, the problem is resolved.

It is claimed to be fixed, and the IDEA runs for me. Just have to wait for Google to integrate the changes into its Android Studio version I suspect.

like image 146
mouckatron Avatar answered Nov 11 '22 14:11

mouckatron