ExceptionInInitializerError - findLibrary返回null

时间:2014-10-10 04:58:24

标签: java android android-layout android-activity parse-platform

我收到了以下错误,并想知道它可能是什么原因。我已经按照与其他所有方法相同的方式安装了库,并且从我的理解应该可以工作。

以下是日志猫

10-10 04:44:03.446: E/AndroidRuntime(1652): FATAL EXCEPTION: main
    10-10 04:44:03.446: E/AndroidRuntime(1652): java.lang.ExceptionInInitializerError
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.sinch.android.rtc.internal.client.ServiceFactory.createUserAgent(ServiceFactory.java:44)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.sinch.android.rtc.internal.client.DefaultSinchClient.<init>(DefaultSinchClient.java:157)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient(InternalSinchClientFactory.java:14)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.sinch.android.rtc.DefaultSinchClientBuilder.build(DefaultSinchClientBuilder.java:95)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.dooba.beta.MessageService.startSinchClient(MessageService.java:56)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.dooba.beta.MessageService.onStartCommand(MessageService.java:40)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2490)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at android.app.ActivityThread.access$1900(ActivityThread.java:130)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at android.os.Handler.dispatchMessage(Handler.java:99)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at android.os.Looper.loop(Looper.java:137)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at android.app.ActivityThread.main(ActivityThread.java:4745)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at java.lang.reflect.Method.invokeNative(Native Method)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at java.lang.reflect.Method.invoke(Method.java:511)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at dalvik.system.NativeStart.main(Native Method)
    10-10 04:44:03.446: E/AndroidRuntime(1652): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sinch-android-rtc: findLibrary returned null
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at java.lang.System.loadLibrary(System.java:535)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     at com.sinch.android.rtc.internal.natives.jni.UserAgentFactory.<clinit>(UserAgentFactory.java:9)
    10-10 04:44:03.446: E/AndroidRuntime(1652):     ... 17 more

以下是触发此错误的代码(一旦用户点击快速聊天按钮):

public class matchOptionActivity1 extends Activity{

    protected TextView mUserRetrieved;
       private String currentUserId;

       protected TextView mUserActivityNameRetrieved;
       protected TextView mUserNameRetrieved;
       protected TextView mUserAgeRetrieved;
       protected TextView mUserHeadlineRetrieved;
       String userGender = ParseUser.getCurrentUser().getString("Gender");
       String activityName = ParseUser.getCurrentUser().getString("ActivityName");
       Number maxDistance = ParseUser.getCurrentUser().getNumber(
               "Maximum_Distance");
       String userLookingGender = ParseUser.getCurrentUser().getString(
               "Looking_Gender");
       Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age");
       Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age");
       Number userage = ParseUser.getCurrentUser().getNumber("UserAge");
       private FeedbackDialog feedBack;
       private ProgressDialog progressDialog;
       private BroadcastReceiver receiver;
       private MessageService.MessageServiceInterface sinchService;
       private Boolean bound = false;





  @Override
  public void onCreate(Bundle savedInstanceState) {

      super.onCreate(savedInstanceState);
      setContentView(R.layout.matchoption);



   feedBack = new FeedbackDialog(this, "AF-46D8F2A319EA-0A");
      ParseQuery<ParseUser> query = ParseUser.getQuery();

      // query.whereEqualTo("ActivityName",userActivitySelectionName);

      query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
              .getObjectId());
      // users with Gender = currentUser.Looking_Gender
      query.whereEqualTo("Gender", userLookingGender);
      // users with Looking_Gender = currentUser.Gender
      query.whereEqualTo("Looking_Gender", userGender);
      query.setLimit(1);
      //  query2.whereEqualTo("UserMatchedRequest1", "confirmed");
      query.whereEqualTo("ActivityName", activityName);
      query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
      query.whereLessThanOrEqualTo("UserAge", maximumAge);

      ParseQuery<ParseUser> query2 = ParseUser.getQuery();

      // query.whereEqualTo("ActivityName",userActivitySelectionName);

      query2.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
              .getObjectId());
      // users with Gender = currentUser.Looking_Gender
      query2.whereEqualTo("Gender", userLookingGender);
      // users with Looking_Gender = currentUser.Gender
      query2.whereEqualTo("Looking_Gender", userGender);
      query2.setLimit(1);
      //  query2.whereEqualTo("UserMatchedRequest1", "confirmed");
      query2.whereEqualTo("ActivityName", activityName);
      query2.whereGreaterThanOrEqualTo("UserAge", minimumAge);
      query2.whereLessThanOrEqualTo("UserAge", maximumAge);

      query.findInBackground(new FindCallback<ParseUser>() {
          @Override
          public void done(List<ParseUser> objects,ParseException e) {

              for(int i=0;i<objects.size();i++){
                  // Do whatever you need to extract object from "users"
                  ParseQuery<ParseObject> query = ParseQuery.getQuery("User");
                  query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                          .getObjectId());
                  // users with Gender = currentUser.Looking_Gender
                  query.whereEqualTo("Gender", userLookingGender);
                  // users with Looking_Gender = currentUser.Gender
                  query.whereEqualTo("Looking_Gender", userGender);
                  query.setLimit(1);
                  //  query2.whereEqualTo("UserMatchedRequest1", "confirmed");

                  query.whereEqualTo("ActivityName", activityName);
                  query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                  query.whereLessThanOrEqualTo("UserAge", maximumAge);

                  mUserNameRetrieved = (TextView) findViewById(R.id.tvmname1);

                  mUserNameRetrieved.setText(objects.get(i).get("Name").toString()); 



              }
  }//for loop
          });

      query2.findInBackground(new FindCallback<ParseUser>() {

          @Override
          public void done(List<ParseUser> objects,ParseException e) {

              for(int i=0;i<objects.size();i++){
                  // Do whatever you need to extract object from "users"
                     ParseQuery<ParseObject> query2 = ParseQuery.getQuery("User");
                     query2.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                             .getObjectId());
                     // users with Gender = currentUser.Looking_Gender
                     query2.whereEqualTo("Gender", userLookingGender);
                     // users with Looking_Gender = currentUser.Gender
                     query2.whereEqualTo("Looking_Gender", userGender);
                     query2.setLimit(1);
                   //  query2.whereEqualTo("UserMatchedRequest1", "confirmed");

                     query2.whereEqualTo("ActivityName", activityName);
                     query2.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                     query2.whereLessThanOrEqualTo("UserAge", maximumAge);


                  ParseFile image = objects.get(i).getParseFile("ProfilePicture");


                  ParseImageView imageView = (ParseImageView) findViewById(R.id.profilePictureresultm);



                   // The placeholder will be used before and during the fetch, to be replaced by the fetched image
                   // data.
                   imageView.setPlaceholder(getResources().getDrawable(R.drawable.profile_pict));
                   imageView.setParseFile(image);

                   imageView.loadInBackground(new GetDataCallback() {
                     @Override
                     public void done(byte[] data, ParseException e) {
                         if (data != null) {
                             Log.i("ParseImageView", "Fetched: " + data.length);
                           } else {
                             Log.e("ParseImageView", "Error fetching: " + e.getMessage());
                           }
                     }


               });
              }
  }//for loop
          });




      final Button ichat = (Button) this.findViewById(R.id.btnQuickChat);
       ichat.setOnClickListener(new OnClickListener() {

           @Override
           public void onClick(View v) {


          openConversation();


           }


           private void openConversation() {
               // TODO Auto-generated method stub
                 ParseQuery<ParseUser> query = ParseUser.getQuery();
                    query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                          .getObjectId());
                       // users with Gender = currentUser.Looking_Gender
                        query.whereEqualTo("Gender", userLookingGender);
                        // users with Looking_Gender = currentUser.Gender
                         query.whereEqualTo("Looking_Gender", userGender);
                        query.setLimit(1);
                       query.whereEqualTo("ActivityName", activityName);
                       query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                        query.whereLessThanOrEqualTo("UserAge", maximumAge);


                   query.findInBackground(new FindCallback<ParseUser>() {
                       public void done(List<ParseUser> user, ParseException e) {
                             if (e == null) {

                                  Intent intent = new Intent(getApplicationContext(), MessagingActivity1.class);
                                  Intent serviceIntent = new Intent(getApplicationContext(), MessageService.class); 
                                  startService(serviceIntent);
                                  intent.putExtra("RECIPIENT_ID", user.get(0).getObjectId());
                                  startActivity(intent);
                              } else {
                                  Toast.makeText(getApplicationContext(),
                                      "Error finding that user",
                                          Toast.LENGTH_SHORT).show();
                              }
                          }
                       });
                   }
       });


}



//show a loading spinner while the sinch client starts
  private void showSpinner() {
      progressDialog = new ProgressDialog(this);
      progressDialog.setTitle("Loading");
      progressDialog.setMessage("Please wait...");
      progressDialog.show();

      receiver = new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
              Boolean success = intent.getBooleanExtra("success", false);
              progressDialog.dismiss();
              if (!success) {
                  Toast.makeText(getApplicationContext(), "Messaging service failed to start", Toast.LENGTH_LONG).show();
              }
          }
      };

      LocalBroadcastManager.getInstance(this).registerReceiver(receiver, new IntentFilter("com.dooba.beta.matchOptionActivity1"));
  }

  @Override
  public void onResume() {

      super.onResume();
  }
}

附件是显示库的图片 enter image description here

任何帮助都会非常感激,因为我一直在努力解决这个错误。

注意:我正在使用eclipse

1 个答案:

答案 0 :(得分:2)

您在哪个设备上测试应用程序,sinch SDK没有x86库,您将在任何基于x86的Android设备或模拟器(Intel HAXM)上看到findLibrary returned null消息 - 包括genymotion。