I have an activity called sample activity. From this activity, I discovered the intention, it was the operation navigationlayout1, in which there was a PayPal service. Oncreate this service should be added as they (paypal) made in their example. I did not have this problem before when I did not use the multidex option.
I got an error such as "exit value 2", my gradle was unable to execute due to this error. I did some research to clear this error.
Finally, my previous error (output value 2) cleared. I was happy because now there is no mistake. But suddenly I got this error. Over the past 3 days, I am stuck in error. I do research all the time. This is the right time to ask here without spending me more time. Please help me.
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: okhttp3.internal.tls.OkHostnameVerifier
at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.java:364)
at com.paypal.android.sdk.cc.a(Unknown Source)
at com.paypal.android.sdk.cm.<init>(Unknown Source)
at com.paypal.android.sdk.payments.PayPalService.a(Unknown Source)
at com.paypal.android.sdk.payments.PayPalService.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2656)
at android.app.ActivityThread.access$1900(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
My code
Intent intent = new Intent(getActivity(), NavigationLayout1.class);
startActivity(intent);
this page will be open
NavigationLayout1.java
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import com.example.administrator.login.R;
import com.example.administrator.login.helper.ImageLoader;
import com.paypal.android.sdk.payments.PayPalConfiguration;
import com.paypal.android.sdk.payments.PayPalPayment;
import com.paypal.android.sdk.payments.PayPalService;
public class NavigationLayout1 extends AppCompatActivity {
private static final String CONFIG_ENVIRONMENT = PayPalConfiguration.ENVIRONMENT_SANDBOX;
private static final String CONFIG_CLIENT_ID = "Af3H9MCGkS0bGBEdj_KFIeZU6uip0RK0hLEONpOxo73KYpboXEsAiib6kwUXfM2n-W3wr9b2bQ_JRKhB";
private static final int REQUEST_CODE_PAYMENT = 1;
private static final int REQUEST_CODE_FUTURE_PAYMENT = 2;
private static PayPalConfiguration config = new PayPalConfiguration()
.environment(CONFIG_ENVIRONMENT)
.clientId(CONFIG_CLIENT_ID)
.merchantName("Hipster Store")
.merchantPrivacyPolicyUri(
Uri.parse("https://www.example.com/privacy"))
.merchantUserAgreementUri(
Uri.parse("https://www.example.com/legal"));
PayPalPayment thingToBuy;
private String data;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.navigation_layout1);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
data=this.getIntent().getStringExtra("total");
Intent intent = new Intent(this, PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startService(intent);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
super.onBackPressed();
finish();
return true;
}
}
But I get the above error. Please help me
source
share