Error while integrating Paypal in Android - android

I am new to android and i try to integrate Paypal in Android. I follow this official tutorial
https://github.com/paypal/PayPal-Android-SDK/blob/master/docs/single_payment.md
I got the following error
uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.paypal.sdk:paypal-android-sdk:2.14.3] /home/developer/Desktop/Jac - Android/jac/build/intermediates/exploded-aar/com.paypal.sdk/paypal-android-sdk/2.14.3/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.paypal.android.sdk.payments" to force usage
I write this code in the menifest file and this error removes:
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk tools:overrideLibrary="com.paypal.android.sdk.payments"/>
But it generate few more errors:
FATAL EXCEPTION: OkHttp Dispatcher
Process: com.knysys.jac.jaclassified, PID: 1982
java.lang.NoSuchMethodError: No virtual method log(Ljava/lang/String;)V in class Lokhttp3/internal/Platform; or its super classes (declaration of 'okhttp3.internal.Platform'
appears in /data/app/com.knysys.jac.jaclassified-2/base.apk)
at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:108)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:157)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
at okhttp3.RealCall.access$100(RealCall.java:30)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
I have these dependencies in my gradle still i get these issues
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.0-RC1'
Where am i wrong. Why it generate such an error. Any help or any other solution to achieve that. Thankyou.

read this link and follow these steps.
http://www.articlesbase.com/online-education-articles/how-to-integrate-paypal-in-eclipse-and-android-studio-7389133.html

Make changes in your manifest :-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javatpoint.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="" //change minSDK to 16 or more
android:targetSdkVersion="" /> //change targetSdk to 19 or more
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Related

Fatal Exception: android.content.ActivityNotFoundException | android.gms.ads.AdActivity (ADMOB)

Since today at an amazing speed Admob is crashing when trying to display an Add according to Firebase.
Also Crashlytics is not getting the mapping... do not know why
This happens in every version of android 4, 5, 6, 7, 8, 9, 10.
Fatal Exception: android.content.ActivityNotFoundException
Unable to find explicit activity class {com.myCompany.myApp/com.google.android.gms.ads.AdActivity}; have you declared this activity in your AndroidManifest.xml?
com.myCompany.myApp.GameActivity.E
android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1933)
android.app.Instrumentation.execStartActivity (Instrumentation.java:1616)
android.app.ContextImpl.startActivity (ContextImpl.java:904)
android.app.ContextImpl.startActivity (ContextImpl.java:882)
android.content.ContextWrapper.startActivity (ContextWrapper.java:383)
com.google.android.gms.internal.ads.Di.a (Unknown Source:9)
com.google.android.gms.ads.internal.overlay.zzn.a (Unknown Source:77)
com.google.android.gms.internal.ads.KC.a (Unknown Source:76)
com.google.android.gms.internal.ads.zu.a (Unknown Source:9)
com.google.android.gms.internal.ads.cF.showInterstitial (Unknown Source:24)
com.google.android.gms.internal.ads.Cea.c (Unknown Source:7)
com.google.android.gms.ads.InterstitialAd.c (Unknown Source:2)
com.myCompany.myApp.GameActivity.E (Unknown Source:82)
com.myCompany.myApp.X.onClick (Unknown Source:4)
android.view.View.performClick (View.java:6390)
Tried to reproduce the error locally, but couldn't
This started suddenly... and is in the only app that I'm getting that error in Firebase (all are implemented the same way)
Gradle
dependencies {
...
implementation 'com.google.android.gms:play-services-ads:18.2.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
...
}
MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myCompany.MyApp"
android:installLocation="auto">
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true"
/>
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
>
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="THENUMBERFORMYADMOB"/>
<service
android:name=".services.MusicService"
android:enabled="true"/>
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${crashlyticsCollectionEnabled}" />
<activity
android:name=".SplashActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".LevelsActivity"
android:label="#string/title_activity_game"
android:parentActivityName=".SplashActivity">
</activity>
<activity
android:name=".GameActivity"
android:keepScreenOn="true"
android:label="#string/title_activity_game"
android:parentActivityName=".LevelsActivity">
</activity>
...
OTHER ACTIVITIES
...
</application>
</manifest>
I implemented Admob accordingly to the guide.
¿Should I add an Admob activity?
In google play crash report I'm getting reports regarding
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
WebViewGoogle.apk
#00 pc 00000000008fca14 /system/app/WebViewGoogle/WebViewGoogle.apk
But this has been for a long time (since 1' July... when started suddenly with a spike...) and google is "fixing it"... could this be related?

Errors in manifest

After I switched from Eclipse to Android Studio, i got these errors, and i have now idea how to solve them, i'm still not familiar with AS.
[com.google.firebase:firebase-iid:9.8.0] K:\drawing-board\build\intermediates\exploded-aar\com.google.firebase\firebase-iid\9.8.0\AndroidManifest.xml:24:17-71 Error:
Attribute permission#${applicationId}.permission.C2D_MESSAGE#name at [com.google.firebase:firebase-iid:9.8.0] AndroidManifest.xml:24:17-71 requires a placeholder substitution but no value for <applicationId> is provided.
[com.google.firebase:firebase-iid:9.8.0] K:\drawing-board\build\intermediates\exploded-aar\com.google.firebase\firebase-iid\9.8.0\AndroidManifest.xml:26:22-76 Error:
Attribute uses-permission#${applicationId}.permission.C2D_MESSAGE#name at [com.google.firebase:firebase-iid:9.8.0] AndroidManifest.xml:26:22-76 requires a placeholder substitution but no value for <applicationId> is provided.
[com.google.firebase:firebase-iid:9.8.0] K:\drawing-board\build\intermediates\exploded-aar\com.google.firebase\firebase-iid\9.8.0\AndroidManifest.xml:34:27-58 Error:
Attribute category#${applicationId}#name at [com.google.firebase:firebase-iid:9.8.0] AndroidManifest.xml:34:27-58 requires a placeholder substitution but no value for <applicationId> is provided.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
[com.google.firebase:firebase-common:9.8.0] K:\drawing-board\build\intermediates\exploded-aar\com.google.firebase\firebase-common\9.8.0\AndroidManifest.xml:6:19-78 Error:
Attribute provider#com.google.firebase.provider.FirebaseInitProvider#authorities at [com.google.firebase:firebase-common:9.8.0] AndroidManifest.xml:6:19-78 requires a placeholder substitution but no value for <applicationId> is provided.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
K:\drawing-board\AndroidManifest.xml:57:13-59:29 Error:
Missing one of the key attributes 'action#name,category#name' on element intent-filter at AndroidManifest.xml:57:13-59:29
K:\drawing-board\AndroidManifest.xml Error:
Validation failed, exiting
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Thank you!
Sorry here's my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.dessin"
android:versionCode="25"
android:versionName="2.1.4" >
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true" />
<uses-sdk android:minSdkVersion="11" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light">
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".Splash"
android:label="#string/app_name"
android:exported="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".StickerDialog" android:label="Dialog Example"
android:theme="#android:style/Theme.NoTitleBar" />
<activity
android:name=".Paint"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden">
<intent-filter>
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
</application>
</manifest>
How i can merge the manifest?? and fix these bugs? and how the hell i can stop these errors for god sake!!! Thank you very much!!
You need to add the applicationId placeholder to the application gradle. This happens with the integration of Firebase, after updating to Gradle 2.2.0-alpha1
android {
...
defaultConfig {
applicationId "com.example.my.app"
...
}
}
Worked for me..
Found here

AdMob still not working

I got a problem regarding Google AdMob:
I try to display a Interstitial, for this I have added the AdActivity, permissions and meta-tags to manifest.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lunation.warface"
android:versionCode="10"
android:versionName="1.4" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#style/AppTheme"
android:windowSoftInputMode="adjustPan|adjustResize" >
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!--Include the AdActivity configChanges and theme. -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="sensorPortrait"
android:windowSoftInputMode="adjustPan|adjustResize" >
<intent-filter>
</intent-filter>
</activity>
<activity
android:name=".SplashScreen"
android:noHistory="true"
android:screenOrientation="sensorPortrait"
android:theme="#style/Theme.Transparent" >
<intent-filter>
<action android:name="android.intent.action.MAIN" >
</action>
<category android:name="android.intent.category.LAUNCHER" >
</category>
</intent-filter>
</activity>
<activity android:name="gallery.FullScreenViewActivity"></activity>
</application>
</manifest>
In MainActivity:
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("xxx/xxx");
AdRequest adRequest = new AdRequest.Builder().build();
mInterstitialAd.loadAd(adRequest);
if (mInterstitialAd != null && mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
Logcat:
04-04 15:15:19.397: W/Ads(19752): There was a problem getting an ad response. ErrorCode: 0
04-04 15:15:19.407: I/dalvikvm(19752): Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.s.g.<init>
04-04 15:15:19.407: W/dalvikvm(19752): VFY: unable to resolve virtual method 3153: Landroid/webkit/WebSettings;.setMixedContentMode (I)V
04-04 15:15:19.407: D/dalvikvm(19752): VFY: replacing opcode 0x6e at 0x004a
04-04 15:15:19.502: W/Ads(19752): Failed to load ad: 0
Besides there is also a compilation error:
Conversion of dalvik format failed with error code 1
I tried about 20 answers, still not working.
I also dont know whether the problem is the unit id, I can change
mInterstitialAd.setAdUnitId("xxx/xxx");
to:
mInterstitialAd.setAdUnitId("xxx");
and I got the same errors.
I use the following external libraries:
android support v4&v7, picasso, ftpclient(commons, httpmime),FAB
Does somebody have a advice?
Greetings
Solution found!
Seems like some features in CyanogenMod blocks AdMob.
Flashed a new version WITHOUT Adaware and blocking Tools.
WORKING NOW :D

error AppCompat you need use app.themecompat

referring to thread Unfortunately, 'app_name' has stopped, I solved it, I get a new error:
FATAL EXCEPTION: main
Process: com.cursoandroid.miarrayadapter, PID: 1253
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cursoandroid.miarrayadapter/com.cursoandroid.miarrayadapter.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread
Mi main Activity is already app.compat
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cursoandroid.miarrayadapter" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat" >
<activity
android:theme="#style/Theme.AppCompat"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
But I´m geeting to execute the application:
I dont understand it?
Since you are using the appcompat library the xmlns attribute in menu_main.xml should be:
<menu xmlns:yourapp="http://schemas.android.com/apk/res-auto" .... >
as given in the android documentation:
http://developer.android.com/guide/topics/ui/actionbar.html

UserManager getUserCount() (Jelly Bean)

I am working on this class : UserManager
public int getUserCount ()
Return the number of users currently created on the device.
My code is:
UserManager um = (UserManager) getSystemService(USER_SERVICE);
int count = um.getUserCount();
Log.i("count",""+count);
It produce error like this:
Caused by: java.lang.SecurityException: You need MANAGE_USERS permission to: query users
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.os.IUserManager$Stub$Proxy.getUsers(IUserManager.java:321)
at android.os.UserManager.getUsers(UserManager.java:198)
at android.os.UserManager.getUserCount(UserManager.java:186)
at com.example.multiusertest.MainActivity.onCreate(MainActivity.java:52)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
I already added this permission manually in Manifest file. Does anyone know why it is produce.
Manifest File:
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.MANAGE_USERS"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.multiusertest.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
The MANAGE_USERS has a protectionlevel of signature|system, which means that the application has to be signed with the platform key. See this thread on XDA

Categories

Resources