Amazon Device Messaging Stub! Android Studio - android

I'm trying to integrate Amazon Device Messaging with Android Studio. First I followed (integrating-your-app-with-adm). When I call
ADM adm = new ADM(getActivity());
if (adm.isSupported()) {
// ...
}
There's this output on logcat:
E/AndroidRuntime(24472): java.lang.RuntimeException: Stub!
E/AndroidRuntime(24472): at com.amazon.device.messaging.ADM.(Unknown Source)
So I followed Amazons (Integrating Amazon Libraries with Android Studio ) with the same result.
Then I tried this and this without success.
My AndroidManifest.xml looks like this:
...
<uses-permission android:name="de.mypackage.permission.RECEIVE_ADM_MESSAGE" />
<uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />
<permission android:name=".permission.RECEIVE_ADM_MESSAGE" android:protectionLevel="signature" />
...
<application
android:name=".MyPackageApplication"
android:allowBackup="true"
android:allowClearUserData="true"
android:hardwareAccelerated="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
...
<service android:name=".service.ADMNotificationService" android:exported="false" />
<amazon:enable-feature android:name="com.amazon.device.messaging" android:required="true" />
<receiver android:name=".service.ADMNotificationService$MessageAlertReceiver"
android:permission="com.amazon.device.messaging.permission.SEND">
<intent-filter>
<action android:name="com.amazon.device.messaging.intent.REGISTRATION" />
<action android:name="com.amazon.device.messaging.intent.RECEIVE" />
<category android:name="de.mypackage"/>
</intent-filter>
</receiver>
...
</application>
The local build.gradle looks like this:
...
dependencies {
...
provided files('libs/amazon-device-messaging-1.0.1.jar')
...
}
May you have an idea?

You probably have something along this lines in your dependencies section:
compile fileTree(include: ['*.jar'], dir: 'libs')
This means you're compiling all jars in libs folder into your app. So probably the answer that says switch compile to provided works, but in addition to provided you do compile for all jars in libs folder anyway.
You would need to remove the fileTree line, and include any jars you have there (excluding amazon-device-messaging-1.0.1.jar) manually.

The solution to fix the crash is to edit the build.gradle (Module:app) file.
Remove the line: compile fileTree(include: ['.jar'], dir: 'libs')*
Go to the libs folder and find out all the jar files you require
Include them one by one for compilation. For example, compile files('libs/ePOS2.jar')
Add ADM jar file provided files('libs/amazon-device-messaging-1.0.1.jar')
Build the project

Related

All Activities and layouts got corrupted in Android Studio

I am working on a projects since 3 months. Today most of my activities and xml files got corrupted. I have tried deleting workspace.iml file but it remains same.Local History in VCS is also empty. Is there any way to recover my code or solve this issue.
Note These files are same as previous if I open then in Notepad app/scrc/main/activity.java, but showing different in Android studio
Here what my code looks like now
<component name="libraryTable"> <library name="Gradle: com.google.firebase:firebase-measurement-connector-impl-17.0.3">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/firebase-measurement-connector-impl-17.0.3.aar/fb2536827bf92d82ab72080a9863eb78/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/firebase-measurement-connector-impl-17.0.3.aar/fb2536827bf92d82ab72080a9863eb78/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
gradle file:
apply plugin: 'com.android.application'apply plugin: 'com.google.gms.google-services'android {
compileSdkVersion 28
defaultConfig {
applicationId "com.apkfeast.class11walkthrogh"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.github.bumptech.glide:annotations:4.8.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.android.support:multidex:1.0.3'}apply plugin: 'com.google.gms.google-services'
Manifest
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.apkfeast.class11walkthrogh"
android:screenOrientation="portrait" >
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:fullBackupContent="true">
<activity android:name=".Splash">
<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>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
<activity android:name=".Hyderabad" />
<activity android:name=".Mirpurkhas" />
<activity android:name=".SelectBoard" />
<activity android:name=".Quiz" />
<activity android:name=".Notes" />
<activity android:name=".fedral" />
<activity android:name=".sukkur" />
<activity android:name=".larkana" />
<activity android:name=".aghakhan" />
<activity android:name=".sarghoda" />
<activity android:name=".Rawalpindi" />
<activity android:name=".Faisalabad" />
<activity android:name=".Multan" />
<activity android:name=".Gujranwala" />
<activity android:name=".lahore" />
<activity android:name=".karachi" />
<activity android:name=".sahiwal" />
<activity android:name=".dgkhan" />
<activity android:name=".peshawar" />
<activity android:name=".bahawalpur" />
<activity android:name=".balochistan" />
<activity android:name=".hydchem" />
<activity android:name=".hydphy" />
<activity android:name=".hydbio" />
<activity android:name=".hydeng" />
<activity android:name=".hydisl" />
<activity android:name=".hydurd" />
<activity android:name=".hydmat" />
<activity android:name=".hydpak" />
<activity android:name=".hydviewdown" />
<activity android:name=".mpkVD" />
<activity android:name=".fedVD" />
<activity android:name=".sukVD" />
<activity android:name=".larVD" />
<activity android:name=".sarVD" />
<activity android:name=".rawVD" />
<activity android:name=".faiVD" />
<activity android:name=".mulVD" />
<activity android:name=".gujVD" />
<activity android:name=".lahVD" />
<activity android:name=".khiVD" />
<activity android:name=".sahVD" />
<activity android:name=".dgkVD" />
<activity android:name=".pesVD" />
<activity android:name=".bahVD" />
<activity android:name=".balVD" />
<activity android:name=".result" />
<activity android:name=".bioquiz" />
<activity android:name=".chemquiz" />
<activity android:name=".phyquiz" />
<activity android:name=".full" />
</application>
</manifest>
Solved
I have fixed it by deleting all the files in C:\Users\cc.AndroidStudio3.2\system\caches.
I also had the same problem this morning.
I thought this was due to migrating to AndroidX but
It was wrong. It may occur due to improper indexing and building for e.g. the indexing is force stopped. or due to some IDE issues.
The isuue resolved by deleting gradle and .idea folder in project
and clearing cache of Android Studio IDE by D:\Users\ABCD.AndroidStudio3.2\system\caches.
And issue was resolved.
Note:- Please take Project Backups Daily.
Solution for Android studio Arctic Fox and Higher Versions
Steps
Exit Android Studio
Delete caches folder from
C:\Users\{username}\AppData\Local\Google\AndroidStudio2020.3 // For Arctic Fox
Open Android Studio and your code has being Perfect
Check your Android studio version and Target that version folder at below location
C:\Users\{username}\AppData\Local\Google
Note : AppData folder is Hidden in Windows
Erasing the cache of the Android studio will resolve the problem, for that you have to go to:
C:\Users\user\.AndroidStudio3.5\system\caches
(On windows)
and on Mac:
~/.AndroidStudio3.5/system/caches
Delete all the files there and restart the Android studio.
I solved that by
Close project you are working on
//This enables deleting all cache files
Close android studio
navigate to .AndroidStudio folder and then sytem then cache
delete the cache
Go to your project folder delete delete gradle and .idea folder
delete app.iml file too
import project dont open as exixting.
Boom you done.
Delete caches folder of the android studio
Solutions for android studio 3.6 or below android studio 3.6
C:\Users\{user}\.AndroidStudio{version}\system\caches
And above android studio 3.6 or android studio arctic fox
C:\Users\{user}\AppData\Local\Google\AndroidStudio{version}\cache
Close android studio then delete the cache found in
C:\Users\**user**\.AndroidStudio3.6\system\caches
Important not to modify a file before having deleted the android studio cache
If you modify a file you risk not being able to recover your old code
Rename your project folder and delete .gradle and .idea file inside project folder
I am also facing the same issue so i am copy the files from Project location which is corrupted. In my case, there is list of files corrupted due to module added in Login Activity
build.gradle (Project)
build.gradle (App-level)
AndroidManifest.xml
activity_login.xml
ActivityLogin
Steps to solve the problem
I have deleting .iml and .idea file then restart the Android Studio.
Paste the content from Project Location which is corrupted
Commenting the code in which module classes available
Run the application
If you are using git then rollback the changes in corrupted files as copy-paste process as done in Step-2
Above one process is working for me.
It's only a project cache problem (if you see all files in Notepad, it will look fine. No file is corrupt.).
I have 100% working solution.
Close Android Studio
Copy project folder
Rename new project folder
Re-start Android Studio
File->New-> Import from new folder
Delete old folder.

Unresolved package "generated" in AndroidManifest.xml

In my Android Studio androidManifest.xml file, I found an unresolved package generated. How can I fix it?
The issued code is : android:name=".provider.generated.SquawkProvider
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.aaa">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name=".provider.generated.SquawkProvider"
<!-- shows unresolved package "generated" -->
android:authorities="com.example.android.aaa.provider.provider"
android:exported="false" >
</provider>
<activity
android:name=".following.FollowingPreferenceActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<service
android:name=".fcm.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
This issue stems from annotation processing now being included in Gradle from version 2.2. You can fix project and get it running with the following changes.
Project level "build.gradle" remove this line:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
App level "build.gradle" remove this line:
apply plugin: 'android-apt'
and change this line replacing apt with annotationProcessor:
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
In build.gradle(Module:app)
remove this two line
1) Top on the file
apply plugin: 'android-apt'
2) in dependencies
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
add this
annotationProcessor 'net.simonvt.schematic:schematic-compiler:0.6.3'
If the above responses don't work for you, make sure you are using the latest version of Android Studio and gradle plugin (4.4 as of this post) and have changed all the 'compile' lines with 'implementation'.
After that try Build -> Clean Project then Build -> Rebuild Project. (All of this after following #drspaceboo's answer of deleting classpath and plugin lines, then changing apt to annotationProcessor.)
Try this:-
Go to File -> Invalidate Caches / Restart and then Invalidate and Restart.

Start Activity residing inside Cordova Plugin's aar's file in Ionic2 Project

What I am trying to achieve:
I have created Android Plugin Project (cclib-release.aar) which has a targeted Activity.
I want to invoke this Activity in ionic2 using Cordova Plugin which has cclib-release.aar added as dependency inside Cordova Plugin. aar file added in cordova plugin as per this link
Problem facing:
While invoking Activity, I am getting the following error
java.lang.NoClassDefFoundError: Failed resolution of: Lcompute/cclib/MainActivity;
Caused by: java.lang.ClassNotFoundException: Didn't find class "compute.cclib.MainActivity" on path: DexPathList[[zip file "/data/app/com.ionicframework.fragmentwithionic759798-2/base.apk"],nativeLibraryDirectories=[/data/app/com.ionicframework.fragmentwithionic759798-2/lib/arm, /vendor/lib, /system/lib]]
The issue is similar to SO Link in which the issue was resolved.
But even after following similar step's I am getting the above mentioned error!
My Plugin Structure: (cclib-release.aar is my targeted library with Activity)
My Inject.java goes like this
public class Inject extends CordovaPlugin {
#Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("coolMethod")) {
String message = args.getString(0);
this.coolMethod(message, callbackContext);
return true;
}
return false;
}
private void coolMethod(String message, CallbackContext callbackContext) {
if (message != null && message.length() > 0) {
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
Intent intent = new Intent(cordova.getActivity().getApplicationContext(),
compute.cclib.MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
cordova.getActivity().startActivity(intent);
}
});
callbackContext.success(message);
} else {
callbackContext.error("Expected one non-empty string argument.");
}
}
}
Added this plugin in ionic2 using
cordova plugin add PATH_TO_PLUGIN
As per above mentioned answer by SO, I have modified Ionic2 project's AndroidManifest.xml manually .Path =FragmentWithIonic\platforms\android to refer the Activity.
<activity android:label="#string/activity_name"
android:launchMode="singleTop" android:theme="#android:style/Theme.DeviceDefault.NoActionBar"
android:name="compute.cclib.MainActivity">
</activity>
I am invoking this in Ionic2 using below which works fine in other cases.
this.platform.ready().then(() => {
window.plugins.Inject.coolMethod(message, "short", position);
});
I tried to manually import compute.cclib.MainActivity in Inject.java. But invoking Activity is still giving run time error!
Below is the modified FragmentWithIonic\platforms\android\AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true"
android:versionCode="1"
android:versionName="0.0.1"
package="com.ionicframework.fragmentwithionic759798"
xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application android:hardwareAccelerated="true"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:supportsRtl="true">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="#string/activity_name"
android:launchMode="singleTop"
android:name="MainActivity"
android:theme="#android:style/Theme.DeviceDefault.NoActionBar"
android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="#string/activity_name"
android:launchMode="singleTop"
android:theme="#android:style/Theme.DeviceDefault.NoActionBar"
android:name="compute.cclib.MainActivity">
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24" />
</manifest>
What modifications I need to do to invoke Activity in my plugin?
EDIT 1
After #gmmo suggested, I included reference libraries in my Plugin's gradle File (Inject.gradle)
repositories{
jcenter()
maven { url "https://jitpack.io" }
flatDir{
dirs 'aar'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.1.0'
compile(name:'cclib-release', ext:'aar')
}
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
Now I am getting the following error while building my ionic2 project.
A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
[Android Support Repository].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
I have already updated with all license agreements in SDK. I am pretty sure this is due to this lines in Inject.gradle
compile 'com.android.support:appcompat-v7:25.1.0'
Plugin might not able to find the corresponding dependencies
You can definitely invoke full activities inside the aar file. My aar file contained several activities. I have not seen the issue you mentioned, but I have seen path issues when the aar gradle file had problems. You may want to revise your gradle file. This is the one my plugin uses:
repositories{
jcenter()
maven { url "https://jitpack.io" }
flatDir{
dirs 'libs'
}
}
dependencies {
compile 'com.android.support:support-v13:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services-base:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'org.altbeacon:android-beacon-library:2.+'
compile 'com.cloudinary:cloudinary-android:1.2.2'
compile(name:'mysdk', ext:'aar')
}
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
and this is how I invoke activities from the cordova plugin:
#Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
Logger.v(Constants.Engine.LOGGER_TAG_APP, "Plugin Initialized...");
Context context = cordova.getActivity();
// This works for me
Intent intent = new Intent(context, PermissionsActivity.class);
context.startActivity(intent);
}
and snipped of my plugin .xml
<!-- Initialization -->
<platform name="android">
<config-file target="config.xml" parent="/*">
<feature name="PlatformSDK">
<param name="android-package" value="com.mycompany.PlatformSdk.cordova.PlatformSDKCordovaPlugin" />
<param name="onload" value="true" />
</feature>
</config-file>
<framework src="libs/mysdk.gradle" custom="true" type="gradleReference" />
<resource-file src="libs/mysdk.aar" target="libs/mysdk.aar" />
<source-file src="PlatformSDKCordovaPlugin.java" target-dir="src/com/mycompany/PlatformSDK/cordova" />
</platform>
Okey finally I figure out the issue.
Ionic2 project need to update SDK tools by the following command
android update sdk --no-ui --filter extra
Got this input from cordova-plugin-issues
One more command was mentioned which I am not sure about which was the below one. If someone come across similar issue can try this out as well
android update sdk --no-ui --all --filter
A big Thanks to #gmmo , as he gave me the input to add all
dependencies also along with plugin's Inject.gradle .
As I was in an impression that why would this be required after all these dependencies was already covered in Android Plugin Project.

VideoCastControllerActivity: ActivityNotFoundException

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.newco.cooltv.qa/com.google.android.libraries.cast.companionlibrary.cast.player.VideoCastControllerActivity}; have you declared this activity in your AndroidManifest.xml?
i am using cast companion library and tried both way
(1) Add this library from jCenter repo by adding the following line to your project's dependencies:
(2) Use the GitHub source and include that as a module dependency by following these steps:
Both are failing with above exception after call to
loadRemoteMedia(mediaInfo, 0, true);
in build.gradle i have specified below dependencies
// lib for chromecast
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:mediarouter-v7:23.3.0'
compile 'com.google.android.gms:play-services-cast:9.0.2'
compile project(':CastCompanionLibrary')
I am using Andorid Studio 2.1.2 and updated build.gradle of CCL with
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
Make sure you declare that in your Manifest file, something like:
<activity
android:name="com.google.android.libraries.cast.companionlibrary.cast.player.VideoCastControllerActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

AdMob error: Didn't find class "com.google.ads.AdView"

So I'm on Android Studio v 0.3.6 and I'm having problems with Google Play Services. I was already using the Admob jar in my project but I had to update it so I tried to add them via the instructions. My project compiles fine however when I try to run an activity I get the following error:
Didn't find class "com.google.ads.AdView" on path: /data/app/com.mre. example-1. apk
See the full error output here Relevant portion of my build.gradle:
apply plugin: 'android'
dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile 'com.google.android.gms:play-services:4.0.30'
//compile project(':libraries:google-play-services_lib')
//compile files('libs/google-play-services.jar')
...
}
android {
compileSdkVersion 18
buildToolsVersion '18.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
}
}
Here's my manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"ex">
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.appstate.APP_ID"
android:value="#string/app_id" />
...
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
Here's the layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
...
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="50dp"
ads:adSize="BANNER"
ads:adUnitId="#string/ad_unit_id"
ads:loadAdOnCreate="true"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
android:gravity="center" />
...
</RelativeLayout>
Over the past two days I have tried every variation of adding the GPS library to my project, to just the jar to both to none. At first I deleted the jar from my /libs and added the required lines to my build.gradle but that didn't work either. I thank you in advance for any help you can provide.
The package changed to com.google.android.gms.ads.AdRequest and com.google.android.gms.ads.AdView
Change your import and your layouts
Follow this tutorial to migrate your apk.
In my case I forget to add google_play_services_lib to my project. I fixed that by adding this library... Hope it will help someone...
Landed in similar problem while configuring firebase. Need to add play-services as dependency in app level gradle file -
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:9.0.0'
}
Important part here is -
compile 'com.google.android.gms:play-services:9.0.0'
Post this sync your project and all required classes should be available.

Categories

Resources