Android : Getting error, java.lang.VerifyError

on Sunday, October 26, 2014


I am trying to Webview and with that i used 3rd party SDK. When i try to access Info info = AdvertisingIdClient.getAdvertisingIdInfo(MainActivity.this); it gives me error. Below is my Code:



public class MainActivity extends Activity {

public MobileAppTracker mobileAppTracker = null;
WebView webview;
ProgressBar progressbar;
String url = "http://www.trade-24.com/forex-secrets-lp?lName=1348&tag1=mobileapp&Ads_Server=102c178defae24bd76883edbf22069&Campaign_Id=2&Link_ID=688&UtmCreative=";

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// Initialize MAT
MobileAppTracker.init(getApplicationContext(), "", "");
mobileAppTracker = MobileAppTracker.getInstance();

new Thread(new Runnable() {

@Override
public void run() {

try {
Info info = AdvertisingIdClient.getAdvertisingIdInfo(MainActivity.this);
mobileAppTracker.setGoogleAdvertisingId(info.getId(), info.isLimitAdTrackingEnabled());
} catch (IOException e) {

mobileAppTracker.setAndroidId(Secure.getString(getContentResolver(), Secure.ANDROID_ID));

} catch (GooglePlayServicesNotAvailableException e) {

mobileAppTracker.setAndroidId(Secure.getString(getContentResolver(), Secure.ANDROID_ID));
} catch (GooglePlayServicesRepairableException e) {
mobileAppTracker.setAndroidId(Secure.getString(getContentResolver(), Secure.ANDROID_ID));
} catch (NullPointerException e) {
mobileAppTracker.setAndroidId(Secure.getString(getContentResolver(), Secure.ANDROID_ID));
}
}
}).start();

webview = (WebView) findViewById(R.id.webview);

progressbar = (ProgressBar) findViewById(R.id.progress);

webview.loadUrl(url);

webview.getSettings().setJavaScriptEnabled(true);

webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {

MainActivity.this.setProgress(progress * 100);

if (progress < 100 && progressbar.getVisibility() == ProgressBar.GONE) {
progressbar.setVisibility(View.VISIBLE);
}

progressbar.setProgress(progress);

if (progress == 100 && progressbar.getVisibility() == ProgressBar.VISIBLE) {

progressbar.setVisibility(ProgressBar.GONE);
}

}

});

webview.setWebViewClient(new WebViewClient() {

public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {

Toast.makeText(MainActivity.this, "Oh no! " + description, Toast.LENGTH_SHORT).show();
}

@Override
public void onPageFinished(WebView view, String url) {

progressbar.setVisibility(ProgressBar.GONE);

super.onPageFinished(view, url);
}

});
}

@Override
protected void onResume() {
super.onResume();
mobileAppTracker.setReferralSources(this);
// MAT will not function unless the measureSession call is included
mobileAppTracker.measureSession();
}
}


I have searched in stackoverflow, no answer solved my problem. I have already added library in libs folder and also added to Build Path and checked it too.


LOGCAT



10-26 21:30:03.719: E/AndroidRuntime(13903): FATAL EXCEPTION: main
10-26 21:30:03.719: E/AndroidRuntime(13903): java.lang.VerifyError: com.fxguru.MainActivity$1
10-26 21:30:03.719: E/AndroidRuntime(13903): at com.fxguru.MainActivity.onCreate(MainActivity.java:37)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.os.Handler.dispatchMessage(Handler.java:99)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.os.Looper.loop(Looper.java:130)
10-26 21:30:03.719: E/AndroidRuntime(13903): at android.app.ActivityThread.main(ActivityThread.java:3687)
10-26 21:30:03.719: E/AndroidRuntime(13903): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 21:30:03.719: E/AndroidRuntime(13903): at java.lang.reflect.Method.invoke(Method.java:507)
10-26 21:30:03.719: E/AndroidRuntime(13903): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
10-26 21:30:03.719: E/AndroidRuntime(13903): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
10-26 21:30:03.719: E/AndroidRuntime(13903): at dalvik.system.NativeStart.main(Native Method)

0 comments:

Post a Comment