2

enter image description herei am having my manifest file like this

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.basic.adwhrilsample"
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" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
   <activity android:name=".Invoker" android:label="@string/app_name">

  <intent-filter>

    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />

  </intent-filter>

  <meta-data android:value="my sdk key"

    android:name="ADWHIRL_KEY"/>

</activity>
</application>

and the below is my main.xml file

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
android:id="@+id/layout_main">

<com.adwhirl.AdWhirlLayout
    android:id="@+id/adwhirl_layout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

</LinearLayout>

and my Invoker.java activity

package com.basic.adwhrilsample;

import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;

import com.adwhirl.AdWhirlLayout;
import com.adwhirl.AdWhirlLayout.AdWhirlInterface;
import com.adwhirl.AdWhirlManager;
import com.adwhirl.AdWhirlTargeting;

public class Invoker extends Activity implements AdWhirlInterface {

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);

    AdWhirlTargeting.setAge(23);

    AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);

    AdWhirlTargeting.setKeywords("online games gaming");

    AdWhirlTargeting.setPostalCode("94123");

    AdWhirlTargeting.setTestMode(false);

    AdWhirlLayout adWhirlLayout = (AdWhirlLayout)    
findViewById(R.id.adwhirl_layout);

    TextView textView = new TextView(this);

    RelativeLayout.LayoutParams layoutParams = new

    RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,

    LayoutParams.WRAP_CONTENT);

    int diWidth = 320;

    int diHeight = 52;

    int density = (int) getResources().getDisplayMetrics().density;

    adWhirlLayout.setAdWhirlInterface(this);

    adWhirlLayout.setMaxWidth((int) (diWidth * density));

    adWhirlLayout.setMaxHeight((int) (diHeight * density));

    layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);

    textView.setText("Below AdWhirlLayout");

    LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main);

    layout.setGravity(Gravity.CENTER_HORIZONTAL);

    layout.addView(adWhirlLayout, layoutParams);

    layout.addView(textView, layoutParams);

    layout.invalidate();

}

@Override
public void adWhirlGeneric() {

}

}

but i am getting

08-30 10:17:25.194: E/AndroidRuntime(564): java.lang.RuntimeException: Unable to     
instantiate activity   
ComponentInfo{com.basic.adwhrilsample/com.basic.adwhrilsample.Invoker}:  
java.lang.ClassNotFoundException: com.basic.adwhrilsample.Invoker in loader  
dalvik.system.PathClassLoader[/data/app/com.basic.adwhrilsample-2.apk]

Can anyone help me out in solving my issue. Or can anyone provide me a sample working example so that i could follow it

Updated logcat :

enter image description here

enter image description here

G_S
  • 7,068
  • 2
  • 21
  • 51

2 Answers2

0

i think everything is allright just replace imported package replace this

 import android.widget.RelativeLayout.LayoutParams;

by

 import android.view.ViewGroup.LayoutParams;
Khan
  • 7,585
  • 3
  • 27
  • 44
  • [2012-08-30 11:02:18 - AdwhrilSample] Conversion to Dalvik format failed with error 1 . I am getting this error in console when i am trying to run it. Please suggest me. – G_S Aug 30 '12 at 05:33
  • clean and build your project i have the same code which works fine just change the line as given in answer also see this http://stackoverflow.com/questions/2680827/conversion-to-dalvik-format-failed-with-error-1-on-external-jar it bcz of build path of library check it as shown at the above link – Khan Aug 30 '12 at 05:37
  • Conversion to Dalvik format failed with error 1 has been solved but i am with the same logcat error as in the question can u suggest me please – G_S Aug 30 '12 at 05:47
  • Can i have a sample of the working ones so that i can download it and make it work please – G_S Aug 30 '12 at 05:53
  • @SharathG http://paste2.org/p/2168910 check this same code as you have pasted a single line of change check it – Khan Aug 30 '12 at 06:29
  • updated the warnings in the quesiton and even this error java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. – G_S Aug 30 '12 at 06:42
  • Initially i am getting some data but later i am not able to get the pictures onto my emulator nor even on the mobile. Can you suggest please – G_S Aug 30 '12 at 06:57
0

Try deleting ur bin directory of the project and then clean the project build it and run. I think ur class file is not present in the .dex extension it sometimes happens when the files dont get properly compiled. Also check if there is no error of build path.

Chandrashekhar
  • 498
  • 4
  • 19
  • can u share the full logcat output please ? – Chandrashekhar Sep 10 '12 at 12:06
  • yes the above two captures are the full logcat output and next the same is beign repeated – G_S Sep 10 '12 at 12:08
  • I just wanted to make sure that the jar u included is getting packaged with ur class file. If not it can also cause the same error. – Chandrashekhar Sep 10 '12 at 12:20
  • yes i included this jar file AdWhirlSDK_Android_3.1.1.jar . Is this sufficient? – G_S Sep 10 '12 at 12:25
  • Which version of adt pluggin r u using ? – Chandrashekhar Sep 10 '12 at 12:29
  • Comment all ur code which is using the reference to the jar u have included and then run the sample if it runs then ur jar file is not getting packaged with ur apk. – Chandrashekhar Sep 10 '12 at 12:33
  • It is Android Development Toolkit Version: 20.0.0.v201206242043-391819 – G_S Sep 10 '12 at 12:33
  • please do what i mentioned in my last comment. – Chandrashekhar Sep 10 '12 at 12:40
  • Now i am simply left with a blank screen with the same warnings as in the previous capture – G_S Sep 10 '12 at 17:26
  • i even got this above the warnings : java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. I simply used this paste2.org/p/2168910 as my reference and changed the sdk key in it – G_S Sep 10 '12 at 17:40
  • check the same question here please http://stackoverflow.com/questions/12200424/adwhril-sample-not-working – G_S Sep 11 '12 at 16:13