java.lang.IncompatibleClassChangeError SectionsPagerAdapter从eclipse导入的问题

时间:2016-05-07 23:20:19

标签: android eclipse android-studio-2.0

我已经将我的代码从eclipse导入到android studio 2.0,但是当我尝试使用 SectionsPagerAdapter 来访问某个特定的函数时,它无效。

这是例外:

05-07 19:45:34.113 12102-12102/com.xxx.xactivity E/AndroidRuntime: FATAL EXCEPTION: main
                                                                     Process: com.xxx.xactivity, PID: 12102
                                                                     java.lang.IncompatibleClassChangeError: com.xxx.xactivity.RegistrerActivity$SectionsPagerAdapter
                                                                         at com.xxx.xactivity.RegistrerActivity.onCreate(RegistrerActivity.java:91)
                                                                         at android.app.Activity.performCreate(Activity.java:6245)
                                                                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
                                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
                                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
                                                                         at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:148)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5443)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

这是我在注册类别上的导入代码:

 import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    import java.util.Locale;
    import org.apache.http.HttpResponse;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.ClientProtocolException;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.message.BasicNameValuePair;
    import android.accounts.AccountManager;
    import android.app.Activity;
    import android.app.Fragment;
    import android.app.FragmentManager;
    import android.content.Context;
    import android.content.Intent;
    import android.net.Uri;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.provider.Settings.Secure;
    import android.support.v13.app.FragmentPagerAdapter;
    import android.support.v13.app.FragmentStatePagerAdapter;
    import android.support.v4.view.PagerAdapter;
    import android.support.v4.view.ViewPager;
    import android.view.LayoutInflater;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.MotionEvent;
    import android.view.View;
    import android.view.View.OnTouchListener;
    import android.view.ViewGroup;
    import android.view.animation.Animation;
    import android.view.animation.AnimationUtils;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ImageView;
    import android.widget.ProgressBar;
    import android.widget.TextView;
    import android.widget.Toast;
    import com.google.android.gms.appindexing.Action;
    import com.google.android.gms.appindexing.AppIndex;
    import com.google.android.gms.common.api.GoogleApiClient;

1 个答案:

答案 0 :(得分:0)

解决方案非常简单,仅在build.gradle(模块)上替换,并且工作正常。

compile files('libs/android-support-v13.jar')

compile 'com.android.support:support-v13:23.0.+'