1

I have viewed most of the other threads regarding this error but have not found an answer.

I started a new project a couple of weeks ago using a plugin and the example project with the plugin. Added various of my own features and designs and no problems running the project.

Then updated to ADT 17 2 days ago and this seriously messed things up for me. Started getting class path errors to name a few. I then reverted back to adt 16 which fixed the errors and my project compiles fine but as soon as i run it it crashes on the test device.

I have checked that my compliance level is correct, checked library paths, api versions, manifest xml, basically everything. I do not get how something that use to work perfectly can now just not work.

I proceeded to unistall everything and did a reinstall on the sdk's ADT and java, but to no avail, even just trying to run the example project just crashes.

I have aslo uninstalled the app from the device and rbooted the device and cleared the cache. I am at the end of my rope. Like i say, i have checked libraries and everything, its just this runtime error.

I also increased the connection time out, and added "android:installLocation="preferExternal" to my manifest, no change.

Please help, there cant be an issue with the code as it worked perfectly.

Please see the code for the starting activity:

package com.yourcompany.junaioplugin.template;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;

import com.yourcompany.junaioplugin.template.R;

import com.metaio.junaio.plugin.JunaioPlugin;

public class SplashActivity extends Activity
{

static
{
    JunaioPlugin.loadNativeLibs();
}

/**
 * standard tag used for all the debug messages
 */
public static final String TAG = "junaioPluginTemplate";

/**
 * Display log messages with debug priority 
 * 
 * @param msg Message to display
 * @see Log#d(String, String)
 */
public static void log(String msg)
{
    if (msg != null)
        Log.d(TAG, msg);

}

/**
 * Progress dialog
 */
private ProgressDialog progressDialog;


 @Override
public void onCreate(Bundle savedInstanceState) 
{
     super.onCreate(savedInstanceState);

     setContentView( R.layout.main );

     JunaioStarterTask junaioStarter = new JunaioStarterTask();
     junaioStarter.execute(1);
}


private class JunaioStarterTask extends AsyncTask<Integer, Integer, Integer>
{

    @Override
    protected void onPreExecute()
    {
        progressDialog =  ProgressDialog.show(SplashActivity.this,            "junaio", "Starting up...");
    }

    @Override
    protected Integer doInBackground(Integer... params) 
    {

        // Set authentication if a private channel is used
//          JunaioPlugin.setAuthentication("username", "password");

        // Start junaio, this will initialize everything the plugin need
        int result = JunaioPlugin.startJunaio(this, getApplicationContext());

        return result;
    }

    @Override
    protected void onProgressUpdate(Integer... progress) 
    {

    }

    @Override
    protected void onPostExecute(Integer result) 
    {
        if (progressDialog != null)
        {
            progressDialog.cancel();
            progressDialog = null;
        }

        switch (result)
        {
        case JunaioPlugin.ERROR_EXSTORAGE:
            SplashActivity.log("External storage is not available, closing...");
            finish();
            break;
        case JunaioPlugin.ERROR_INSTORAGE:
            SplashActivity.log("Internal storage is not available, closing...");
            finish();
            break;
        case JunaioPlugin.CANCELLED:
            SplashActivity.log("Starting junaio cancelled");
            break;
        case JunaioPlugin.SUCCESS:
            JunaioPlugin.setAuthentication("junaioTester", "test123");
            launchLiveView();
            break;
        }
    }

}


/**
 * Launch junaio live view
 */
private void launchLiveView()
{

    startActivity(new Intent(this, JunaioARViewTestActivity.class));
    finish();
}

@Override
protected void onResume() 
{
    super.onResume();

}

@Override
protected void onPause()
{
    super.onPause();
}

@Override
protected void onStop()
{
    super.onStop();

    if (progressDialog != null)
    {
        progressDialog.cancel();
        progressDialog = null;
    }
}

}

Here is the logcat:

    03-27 10:47:47.543: I/dalvikvm(10641): Could not find method                 com.metaio.junaio.plugin.JunaioPlugin.loadNativeLibs, referenced from method com.yourcompany.junaioplugin.template.SplashActivity.<clinit>

    03-27 10:47:47.543: W/dalvikvm(10641): VFY: unable to resolve static method 65: Lcom/metaio/junaio/plugin/JunaioPlugin;.loadNativeLibs ()V
    03-27 10:47:47.543: D/dalvikvm(10641): VFY: replacing opcode 0x71 at 0x0000
    03-27 10:47:47.543: D/dalvikvm(10641): VFY: dead code 0x0003-0003 in Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit> ()V
    03-27 10:47:47.543: W/dalvikvm(10641): Unable to resolve superclass of Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity; (48)
    03-27 10:47:47.543: W/dalvikvm(10641): Link of class 'Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;' failed
    03-27 10:47:47.547: E/dalvikvm(10641): Could not find class 'com.yourcompany.junaioplugin.template.JunaioARViewTestActivity', referenced from method com.yourcompany.junaioplugin.template.SplashActivity.launchLiveView
    03-27 10:47:47.547: W/dalvikvm(10641): VFY: unable to resolve const-class 78 (Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;) in Lcom/yourcompany/junaioplugin/template/SplashActivity;
    03-27 10:47:47.547: D/dalvikvm(10641): VFY: replacing opcode 0x1c at 0x0002
    03-27 10:47:47.547: D/dalvikvm(10641): VFY: dead code 0x0004-000d in Lcom/yourcompany/junaioplugin/template/SplashActivity;.launchLiveView ()V
    03-27 10:47:47.547: W/dalvikvm(10641): Exception Ljava/lang/NoClassDefFoundError; thrown during Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit>
    03-27 10:47:47.547: W/dalvikvm(10641): Class init failed in newInstance call (Lcom/yourcompany/junaioplugin/template/SplashActivity;)
    03-27 10:47:47.547: D/AndroidRuntime(10641): Shutting down VM
    03-27 10:47:47.547: W/dalvikvm(10641): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
    03-27 10:47:47.555: E/AndroidRuntime(10641): FATAL EXCEPTION: main
    03-27 10:47:47.555: E/AndroidRuntime(10641): java.lang.ExceptionInInitializerError
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at java.lang.Class.newInstanceImpl(Native Method)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at java.lang.Class.newInstance(Class.java:1429)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.os.Handler.dispatchMessage(Handler.java:99)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.os.Looper.loop(Looper.java:123)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at android.app.ActivityThread.main(ActivityThread.java:4627)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at java.lang.reflect.Method.invokeNative(Native Method)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at java.lang.reflect.Method.invoke(Method.java:521)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at dalvik.system.NativeStart.main(Native Method)
    03-27 10:47:47.555: E/AndroidRuntime(10641): Caused by: java.lang.NoClassDefFoundError: com.metaio.junaio.plugin.JunaioPlugin
    03-27 10:47:47.555: E/AndroidRuntime(10641):    at com.yourcompany.junaioplugin.template.SplashActivity.<clinit>(SplashActivity.java:19)
    03-27 10:47:47.555: E/AndroidRuntime(10641):    ... 15 more

Here is the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="3"
android:versionName="3.5.1" package="com.yourcompany.junaioplugin.template"
android:installLocation="preferExternal">

<!-- The application must be compiled using Google APIs (Android 3.0) -->
<!-- However, target and min SDK can be 8 (Android 2.2) -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus"   android:required="false"/>
<uses-feature android:name="android.hardware.location.gps"  android:required="false"/>
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.compass" android:required="false"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />   

<application 
    android:label="@string/app_name" 
    android:icon="@drawable/icon" 
    android:debuggable="true">

    <uses-library android:name="com.google.android.maps" />

    <!-- Start screen -->
    <activity android:name=".SplashActivity"
              android:theme="@style/Theme.Fullscreen"
              android:screenOrientation="portrait"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!-- junaio AR view activity -->
    <activity 
        android:name=".JunaioARViewTestActivity"
        android:theme="@style/Theme.Fullscreen"
        android:configChanges="orientation"
        android:screenOrientation="landscape">
    </activity>

    <activity 
        android:name="com.metaio.junaio.plugin.view.POIDetailDialog"
        android:theme="@style/Theme.POIDialog"
        android:screenOrientation="landscape">
    </activity>

    <activity 
        android:name="com.metaio.junaio.plugin.view.WebViewActivity"
        android:theme="@style/Theme.Fullscreen"
        android:configChanges="orientation">"
    </activity>

    <activity 
        android:name="com.metaio.junaio.plugin.view.ImageViewActivity"
        android:theme="@style/Theme.Fullscreen"
        android:configChanges="orientation">
    </activity>

</application>

</manifest>
stacker
  • 68,052
  • 28
  • 140
  • 210
user1285471
  • 33
  • 1
  • 5
  • 1
    is this "com.metaio.junaio.plugin.JunaioPlugin" a jar file. – Padma Kumar Mar 27 '12 at 10:21
  • 1
    ok, this is how its put together: there are two projects, the one is referenced as a librabry and the JunaioPlugin.class is in this referenced project/referenced libraries/junaioplugin.jar. in the jar theres a com.metaio.junaio.plugin package with the JunaioPlugin.class. but it cant find the source which is weird cos it has always run fine and no changes were made, this is the standard plugin example projects.[link](http://locatesa.co.za/screen/screen.jpg) – user1285471 Mar 27 '12 at 12:29

1 Answers1

2

For me, when I installed ADT 17 I have problems using 3rd party libraries (It kept telling me there were duplications). It turns out that they no longer need to be added to the build path; just kept in a folder in the root of your project called "libs". Could this be the same problem?

NotACleverMan
  • 12,107
  • 12
  • 47
  • 67
  • Are you able to post the source for your JunaioPlugin class? The problem seems to be at: "JunaioPlugin.loadNativeLibs();" – NotACleverMan Mar 27 '12 at 10:24
  • 1
    ok, this is how its put together: there are two projects, the one is referenced as a librabry and the JunaioPlugin.class is in this referenced project/referenced libraries/junaioplugin.jar. in the jar theres a com.metaio.junaio.plugin package with the JunaioPlugin.class. but it cant find the source which is weird cos it has always run fine and no changes were made, this is the standard plugin example projects. – user1285471 Mar 27 '12 at 11:42
  • Are you currently using ADT 16 or 17? – NotACleverMan Mar 27 '12 at 11:55
  • In that screenshot you still have your library in your build path. You should have any 3rd party libs in your build path, just the one libs folder, otherwise it'll break your project. – NotACleverMan Mar 27 '12 at 12:57
  • 1
    soon as i remove it from the build path i get errors, when its in the build path i get no errors but it crashes on the device – user1285471 Mar 27 '12 at 13:54
  • 1
    thanks NotACleverMan, created a new libs folder and moved it there, works now! – user1285471 Mar 28 '12 at 07:34
  • Cool. I'm glad to be of some help. Can you accept the answer so that others know what to do if they search for the same problem? – NotACleverMan Mar 28 '12 at 08:19
  • There should be a little tick under the number to the left of the first answer I left. It looks like this: http://i.imgur.com/kNCCw.png – NotACleverMan Mar 28 '12 at 11:46
  • 1
    Thanks NotACleverMan, you really made me feel like im NotAnIdiot:) – user1285471 Mar 29 '12 at 14:05
  • @NotACleverMan- thanks sooo much plus 1 to you it solved the problem i was not able to solve for 3 hours. – NoviceMe Apr 05 '12 at 04:43