Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid can't find class from external jar
    primarykey
    data
    text
    <p>I am trying to create a simple test app that basically extends the Android Hello World tutorial app by invoking some simple functionality from an external JAR. However, when I run the app, it can't find the class from the JAR. What am I doing wrong?</p> <p>Here's entire source of the JAR:</p> <pre><code>package com.mytests.pow; public class power2 { private double d; public power2() { d = 0.0; } public String stp2(double dd) { d = dd*dd; return String.format("%e", d); } } </code></pre> <p>And here's the "Hello World ++" source:</p> <pre><code>package com.myLuceneTests.namespace; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import com.mytests.pow.*; public class AndroidSimpleSIH_EclipseActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { power2 pp = new power2(); String iout = pp.stp2(12.0); super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(iout); setContentView(tv); } } </code></pre> <p>When I run the app, I get this in logcat:</p> <pre><code>11-22 12:24:52.697 2963 2963 E dalvikvm: Could not find class 'com.mytests.pow.power2', referenced from method com.myLuceneTests.namespace </code></pre> <p>.AndroidSimpleSIH_EclipseActivity.onCreate</p> <p>and then </p> <pre><code>11-22 12:24:52.713 2963 2963 E AndroidRuntime: java.lang.NoClassDefFoundError: com.mytests.pow.power2 </code></pre> <p>What am I doing wrong? Thanks!</p> <p>By the way, my actual goal is to use a real JAR (rather than this toy one) in an Android app. I might have access to the code for that JAR and might be able to rebuild it but it's a big piece of Java code and I am likely to encounter problems when rebuilding it so I am trying to use the pre-built JAR.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload