adwhril sample not working - android

can anyone provide me a sample for integrating adwhril into android.I tried this sample
http://paste2.org/p/2168910
I used the same code as that one replacing the sdk key of mine But i am getting warnings saying
Can anyone suggest me
updated the code as suggested and got this warning

Yea, i have also faced this problem and solved in this way
Add those if you didn't already added in your menifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
In your activity where you want to show the add
<meta-data android:value="---- Your Key ----"
android:name="ADWHIRL_KEY"/>
Now add all the jar of the add provider you used, in your ad-whirl network. Add them to your app's libs folder and then add them to build path by right clicking on them from libs.
For example if you use Admob then add admob's jar to libs and add it to build path. And then add this line to menifest as this is needed to show add from admob individually or by using adwhirl
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>
Now you will see the adds of admob.
Thank you
Ps: i have added the full code with image
Menifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.expadwhirl"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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>
<meta-data android:value="2f120f401e9a40d0afa55557d3a3a58c"
android:name="ADWHIRL_KEY"/>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>
</application>
</manifest>
Layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.adwhirl.AdWhirlLayout
android:id="#+id/adwrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
Activity
import android.app.Activity;
import android.os.Bundle;
import com.adwhirl.AdWhirlLayout;
import com.adwhirl.AdWhirlLayout.AdWhirlInterface;
public class MainActivity extends Activity implements AdWhirlInterface {
AdWhirlLayout adwrl;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public void adWhirlGeneric() {
// TODO Auto-generated method stub
}
}
Overall project

Related

Why i'm getting a white screen in map app

I'm new here and also new in programming.
I'm making map, I have followed a lot of tutorials, all of them very simillar but I don't know why my app doesn't work. The app doesn't crash, but when I open the map appears the app title and a white screen where the map should appear. Do you know why is this happening?
Here are my app manifest, the activity:main.xml and the mainactivity.java, maybe here's the error that I can't find.
Also if helps logcat says me: Error opening trace file: No such file or directory (2)
APP MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tdr.mapa1"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.tdr.mapa1.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="permission_name"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.tdr.mapa1.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps"
android:required="false"/>
<activity
android:name="com.tdr.mapa1.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<API_KEY>"/>
</application>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</manifest>
MAIN ACTIVITY
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
</RelativeLayout>
MAINACTIVITY.JAVA
package com.tdr.mapa1;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Hope you can help me.
See here,just change the api key with your key in manifest file and follow these steps:
and make sure that generate api key with package name which is mentioned in android manifest file and your google_play_services_lib project should be present in your project's work space only.
Manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.geeklabs.map.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="replace with your API key"/>
</application>
</manifest>
MainActivity.java:
package com.geeklabs.map;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
And make sure following steps done correct or not:
Steps:
* to ensure that device has Google Play services APK
* to install Google Play Service rev. more than 2
to create project at https://code.google.com/apis/console/
to enable "Google Maps Android API v2"
to register of SHA1 in project (NOW, YOU NEED WRITE SHA1;your.app.package.name) at APIs console and get API KEY
to copy directory ANDROID_SDK_DIR/extras/google/google_play_services/libproject/google-play-services_lib to root of your project
to add next line to the YOUR_PROJECT/project.properties
android.library.reference.1=google-play-services_lib
to add next lines to the YOUR_PROJECT/proguard-project.txt
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
Okay, now you ready to create your own Google Map app with using Google Map APIs V2 for Android.
If you create application with min SDK = 8, please use android support library v4 + SupportMapFragment instead of MapFragment.
After got this let me know.
First your error:
Error opening trace file: No such file or directory (2)
doesn't mean anything and you should node pay any attention to it.
Second, both meta-data tags should be inside of the application scope, like so:
...
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<API_KEY>"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Lastly, you are not actually creating any map object in your activity layout file, what you have there is an empty RelativeLayout and hence the empty white screen. What you need is to add an MapFragment in there or SupportMapFramgnet depending on your target api. (In your case it would be MapFragment.)
Like so:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
You can get more detailed information from this blog post I wrote on this topic:
Google Maps API V2 Guide

adding google ads to android app not display ads

Working on displaying google ads in android app by using stackoverflow
link
After following instructions it shows ad view but ad not display and on ad view a message appears - you must have AdAcitvity declared in AndroidManifest.xml with config changes.
I have allready added activity in manifest,i am surprising why this occure. Please help me in my problem and give your suggestion .
Thanks in Advance.
This is very Good Example of admob integration into android app.
Your problem is nothing just put into manifest file.
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
The question in the link is a bit old. You should make a few changes:
Use the latest version of AdMob. The latest version is 6.4.1 and you can find it here.
Your manifest should have more config changes declared like this:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
Check all the instructions in the official documentation.
// try this
1. download latest google-play-services,jar
2. add jar to project build path
**main.xml**
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/lnrMain">
</LinearLayout>
public class MyActivity extends FragmentActivity {
LinearLayout lnrMain;
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
lnrMain = (LinearLayout) findViewById(R.id.lnrMain);
runOnUiThread(new Runnable() {
#Override
public void run() {
AdView adView = new AdView(MyActivity.this);
adView.setAdUnitId("0445b7141d9d4e1b");
adView.setAdSize(AdSize.BANNER);
AdRequest.Builder builder = new AdRequest.Builder();
builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
adView.loadAd(builder.build());
lnrMain.addView(adView);
}
});
}
}
**AndroidManifest.xml**
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Demo"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="17"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher">
<activity
android:name="MyActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<meta-data
android:name="ADMOB_ALLOW_LOCATION_FOR_ADS"
android:value="true" />
<meta-data
android:name="com.google.android.gms.version"
android:value="4030500" />
</application>
</manifest>

Android app not starting, probably the android manifest

i want to make my own app, and i just very simply want to start it up. but for some reason i cant make it work on my emulator. I have no error messages so i don't know what is wrong :S Sorry im a novic in programming and i could not find anything that would help me. Thanks !
here are my codes:
xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="#+id/BBG"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Big Bang Theory" />
<Button
android:id="#+id/HIMYM"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="How I Met Your Mother" />
</LinearLayout>
android manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.watchserie"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Menu"
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>
menu java file:
package watchserie.niels;
import com.example.watchserie.R;
import android.app.Activity;
import android.os.Bundle;
public class Menu extends Activity {
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
}
}
Your package names don't match. You Java file is in the watchserie.niels package, while your manifest uses com.example.watchserie. As you're using a dot before the Activity name, it instructs that the package name be automatically added to it. Due to this, you're telling Android that your Activity is: com.example.watchserie.Menu, while in reality it is watchserie.niels.Menu
To fix it, change:
package="com.example.watchserie"
to
package="watchserie.niels"
And remove the following line from your Java file:
import com.example.watchserie.R;
EDIT You could change it the other way around too, but Google Play (and other app stores too I guess) will not allow you to upload any app using the com.example.* namespace. Because of this, I suggested you choose the package without com.example in it.

java.lang.NoClassDefFoundError: com.millennialmedia.android.MMAdView

I am Using Millenial media in my app. i have several apps running with following code but now when i try to copy paste running code for new apps it shows the error java.lang.NoClassDefFoundError: com.millennialmedia.android.MMAdView
this is how i am creating MMAdView object and inserting it in my Linear Layout.
LinearLayout myLayout = (LinearLayout) findViewById(R.id.layoutadd);
adview = new MMAdView(MyClass.this, MYAPID,"MMBannerAdBottom", 30);
myLayout.addView(adview, new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
MMAdListener listener = new MyAdListener();
adview.setListener(listener);
adview.callForAd();
this is the xml declaration
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MyClass"
android:label="#string/app_name"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.millennialmedia.android.MMAdViewOverlayActivity">
</activity>
<activity android:name="com.millennialmedia.android.VideoPlayer"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="keyboardHidden|orientation|keyboard" >
</activity>
</application>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>
i have also imported liabrary...
THIS THING IS WORKING IN MY OTHER APPS JUST IS THAT FROM FEW DAYS ITS NOT WORKING PROPERLY FOR NEW APPS.
This usually happens when the JAR file isn't copied onto the device. On Millennial Media's wiki page, they show you how to add the JAR to your project. After you select the library (9th bullet point), but before you hit "OK", go to the "Order and Export" tab and make sure the checkbox next to MMAdView.jar is checked. By default, it isn't. Push OK and try running your program.

Android java.lang.NoClassDefFoundError when launching new activity

I am getting a java.lang.NoClassDefFoundError when I try to launch my new activity. Below is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.practice.googlemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".LoginActivity"
android:label="Login to your Account">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RegisterActivity"
android:label="Register New Account">
</activity>
<activity
android:name=".GoogleMapsActivity"
android:label="Google Maps">
</activity>
<uses-library android:name="com.google.android.maps"/>
</application>
</manifest>
Code for GoogleMapsActivity.java
package com.practice.googlemaps;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class GoogleMapsActivity extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView)findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
And the following is the line I'm using to launch the new activity:
Intent i = new Intent(getApplicationContext(), GoogleMapsActivity.class);
startActivity(i);
I have checked my class GoogleMapsActivity.java, the file is present and the spelling/wording all match.
I suspect the error may be caused by my AndroidManifest.xml, but I cannot find the problem.
Could someone please point me in the right direction?
Be sure that the <uses-library android:name="com.google.android.maps"/> is right location .
you are definitely missing to add one jar file so that the Noclassdeffound error
will show. and if u have add all jar file even then this error comes then i give you one best answer that definitely works. just create libs folder in ur project and add all jar file in libs folder and your problem definitely solves out.

Categories

Resources