Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Unable to use android libs in console #65

Open
joprice opened this issue Oct 16, 2015 · 1 comment
Open

Unable to use android libs in console #65

joprice opened this issue Oct 16, 2015 · 1 comment

Comments

@joprice
Copy link
Collaborator

joprice commented Oct 16, 2015

I was playing with the start project and writing a helper for defining colors:

package com.example.macroid

import android.graphics.Color

package object starter {
  implicit class HexStringContext(sc: StringContext) {
    def hex(): Int = Color.parseColor("#" + sc.parts.mkString)
  }

  hex"EC4908"
}

and I got the following error:

java.lang.NoClassDefFoundError: android/graphics/Color
  at com.example.macroid.starter.package$HexStringContext.hex(package.scala:7)
  at com.example.macroid.starter.package$.<init>(package.scala:10)
  at com.example.macroid.starter.package$.<clinit>(package.scala)
  ... 43 elided
Caused by: java.lang.ClassNotFoundException: android.graphics.Color
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 46 more
@pfn
Copy link

pfn commented Oct 16, 2015

The android framework is not available in JVM.

On Thu, Oct 15, 2015 at 5:02 PM, Joseph Price [email protected]
wrote:

I was playing with the start project and writing a helper for defining
colors:

package com.example.macroid
import android.graphics.Color
package object starter {
implicit class HexStringContext(sc: StringContext) {
def hex(): Int = Color.parseColor("#" + sc.parts.mkString)
}

hex"EC4908"
}

and I got the following error:

java.lang.NoClassDefFoundError: android/graphics/Color
at com.example.macroid.starter.package$HexStringContext.hex(package.scala:7)
at com.example.macroid.starter.package$.(package.scala:10)
at com.example.macroid.starter.package$.(package.scala)
... 43 elided
Caused by: java.lang.ClassNotFoundException: android.graphics.Color
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 46 more


Reply to this email directly or view it on GitHub
#65.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants