Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7991985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:26:51+00:00 2026-06-04T13:26:51+00:00

I found a workaround to create both library project and main application in scala

  • 0

I found a workaround to create both library project and main application in scala for Android, working with Eclipse, and I would like to share it with you. However, the obscure cleaning process from Eclipse (see problem at the end) is preventing me to implement this feature in my bigger project, where this workaround currently does not work completely.

I assume you have installed a configuration like Eclipse 3.6, the plugin for Scala 2.8.3, the latest Android SDK (18 for me), the treeshaker plugin

Creating the library

  • File > New > Project > Android Project
  • Project Name: TestScalaLibrary, create new, use default location, next
  • Target 2.3.3 API 10, next
  • Application name: TestScalaLibrary, package name com.exampleLibrary, create activity named TestScalaLibraryActivity, finish

Configuring the project TestScalaLibrary as a scala library

  • Right-click on the project, configure, add scala nature
  • Right-click on the project, add/remove Treeshaker.
  • Right-click on the project, properties … android, check “Is Library”, ok
  • Create a new scala class named TestScalaLibraryActivity2 in package com.exampleLibrary with the following content:

    package com.exampleLibrary
    import android.app.Activity
    import android.os.Bundle
    
    class TestScalaLibraryActivity2 extends Activity {
      override def onCreate(savedInstanceState: Bundle) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.main)
      }
    }
    
  • Remove the file TestScalaLibraryActivity.java

  • Update the AndroidManifest.xml by replacing android:name=".TestScalaLibraryActivity" by android:name="com.exampleLibrary.TestScalaLibraryActivity2"
  • Clean the project, let it be built automatically. If at some point you get build errors because testscalalibrary.jar cannot be deleted, do it manually outside of eclipse by temporary closing the projects referencing this library.

Creating the test application

  • File > New > Project > Android Project
  • Project Name: TestScala, create new, use default location, next
  • Target 2.3.3 API 10, next
  • Application name: TestScala, package name com.exampleApplication, create activity named TestScalaActivity

Configuring the project as a scala project

  • Right-click on the project, configure, add scala nature
  • Right-click on the project, add/remove Treeshaker.
  • Right-click on the project, properties … android, library, add… add the project TestScalaLibrary as a library project, ok
  • Edit the AndroidManifest.xml and replace the relative name android:name=".TestScalaActivity" by its absolute equivalent android:name="com.exampleLibrary.TestScalaLibraryActivity2"

Launch it in debug mode (create a new configuration yourself if necessary), it does not work.
You get an Exception RunTimeException.

Looking at LogCat, it eventually tells you where the problem comes from.
Caused by: java.lang.ClassNotFoundException: com.exampleLibrary.TestScalaLibraryActivity2 in loader dalvik.system.PathClassLoader

To fix it, I have the following workaround that i derived from this blog.

  • In the project TestScala, create the class TestScalaActivityDummy with the following code:

    package com.exampleApplication
    class TestScalaActivityDummy {}
    

Launch it in debug mode… it works !

Now the weird part.

  • Remove the file TestScalaActivityDummy.scala (yes, delete the file), clean the project, let it be rebuild automatically. Launch it. It still works !
  • Clean the project again, maybe several times.
    Then if you launch it, you get again a RunTimeException.

Why are these errors appearing after one clean, one launch and one clean?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:26:53+00:00Added an answer on June 4, 2026 at 1:26 pm

    The solution is to start all over without treeshaker but with the AndroidProguardScala plug-in instead :

    https://stackoverflow.com/a/11084146/1287856

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create types Tuple equivalent to the ones in the Scala library,
I would like to create a UIButton which uses a stretchable image as Background
I found a workaround for this error, but am now really curious as to
I am struggling to apply a workaround I found regarding UIWebView accepting tap-events. Source:
This may seem a bit odd, but I really need to create a workaround
I have this problem in my application: Step 1 - create an file (xml)
Here's a ugly bit of Javascript it would be nice to find a workaround.
I have a view like this: CREATE VIEW MyView AS SELECT Column FROM Table
I'm working with Entity Framework 4.1 in an MVC3 Web Application. I am tasked
I've already found a workaround to this problem, but was just wondering if anyone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.