Android Firebase没有这样的方法错误

时间:2017-08-10 17:12:00

标签: android firebase firebase-realtime-database runtime-error

我在片段活动上使用RecyclerView创建了一个项目。但是当我执行这个项目时会出现这样的错误。

  

java.lang.NoSuchMethodError:android.os.Binder #execTransact(int,int,int,int)#exact                                                                   at de.robv.android.xposed.XposedHelpers.findMethodExact(XposedHelpers.java:339)                                                                   at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:176)                                                                   at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:251)                                                                   在com.phoneinfo.changerpro.hooks.g.a(未知来源)                                                                   在com.phoneinfo.changerpro.hooks.MainHook.handleLoadPackage(未知来源)                                                                   at de.robv.android.xposed.IXposedHookLoadPackage $ Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:34)                                                                   at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:61)                                                                   at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:106)                                                                   at de.robv.android.xposed.XposedBridge $ 1.beforeHookedMethod(XposedBridge.java:234)                                                                   at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:1550)                                                                   在android.app.ActivityThread.handleBindApplication()                                                                   在android.app.ActivityThread.access $ 1600(ActivityThread.java:154)                                                                   在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1378)                                                                   在android.os.Handler.dispatchMessage(Handler.java:102)                                                                   在android.os.Looper.loop(Looper.java:135)                                                                   在android.app.ActivityThread.main(ActivityThread.java:5296)                                                                   at java.lang.reflect.Method.invoke(Native Method)                                                                   在java.lang.reflect.Method.invoke(Method.java:372)                                                                   在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:912)                                                                   在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)                                                                   at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:163)   在使用应用程序本身的值时,RecyclerView没有任何错误。但是,当我尝试从Firebase检索值到应用程序时,会发生上述错误并且活动将关闭。

可以采取哪些措施来解决这个问题?

我的代码

public class DocterList extends Fragment {
private DatabaseReference dataref;
private RecyclerView recyclerView;
private List<Doc> result;
private DocViewHolder adapter;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_docter_list, container, false);
    Firebase.setAndroidContext(getActivity());
    dataref = FirebaseDatabase.getInstance().getReference().child("Docters");
    result = new ArrayList<>();
    recyclerView = (RecyclerView) v.findViewById(R.id.docter_list);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(llm);
    FirebaseRecyclerAdapter<Doc,DocViewHolder> adapter=new FirebaseRecyclerAdapter<Doc, DocViewHolder>(
            Doc.class,
            R.layout.view_docter,
            DocViewHolder.class,
            dataref
    ) {
        @Override
        protected void populateViewHolder(DocViewHolder viewHolder, Doc model, int position) {
           viewHolder.setName(model.getName());
            viewHolder.setCity(model.getCity());

        }
    };
    recyclerView.setAdapter(adapter);
    return v;
}
public static class DocViewHolder extends RecyclerView.ViewHolder{
    TextView textName,textPlace;
    public DocViewHolder(View itemView) {
        super(itemView);
        textName= (TextView) itemView.findViewById(R.id.t1);
        textPlace= (TextView) itemView.findViewById(R.id.t2);
    }

    public void setName(String name) {
        textName.setText(name);
    }

    public void setCity(String city) {
        textPlace.setText(city);
    }
}
}

模型Doc类: -

public class Doc {
String Name,City;

public Doc() {
}

public String getCity() {

    return City;
}

public void setCity(String city) {
    City = city;
}

public String getName() {
    return Name;
}

public void setName(String name) {
    Name = name;
}

public Doc(String name, String city) {

    Name = name;
    City = city;
}
}


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
  exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.github.stfalcon:smsverifycatcher:0.3.1'
compile 'com.github.MdFarhanRaja:SearchableSpinner:1.2'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.google.firebase:firebase-crash:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.firebaseui:firebase-ui:0.4.3'
compile 'com.android.support:recyclerview-v7:25.3.1'
}
apply plugin: 'com.google.gms.google-services'

0 个答案:

没有答案