First try making library

walterf25

Expert
Licensed User
Longtime User
Hello all, first of all i know squat about Java, :( however i thought i would try to play around making a library, of course i haven't had much luck, i keep getting this error!
java.lang.IllegalArgumentException: already added: Lcom/google/ads/Ad;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:486)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:95)
1 error; aborting
Standard dexer.

and i have no idea what this means, the library i'm trying to build is for Tapit Ads, i'm following the tutorials found here in the forums to make our own libraries but as i mentioned above i'm not good in java, the code i'm using is below, maybe some of you who are experts in java can take a look at it and help me and maybe give me some pointers on what i'm doing wrong.

thanks,

B4X:
package com.dandre.tapit;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.DontInheritEvents;
import anywheresoftware.b4a.BA.Events;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.objects.ViewWrapper;

import com.tapit.adview.AdInterstitialView;
import com.tapit.adview.AdView;

@Version(1.00f)
@ShortName("TapitAd")
@Events(values={"ReceiveAd", "FailedToReceiveAd (ErrorCode As String)",
        "AdScreenDismissed", "PresentScreen"})
@ActivityObject
@DontInheritEvents
@Permissions(values={"android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE", "android.permissin.READ_PHONE_STATE", })
@DependsOn(values={"TapitAdView"})


public class TapItAds<Zone_Id> extends ViewWrapper<AdView> {
String Zone_Id;



public void Initialize(final BA ba, String EventName, String Zone_Id){
   setObject(new AdView(ba.activity, Zone_Id));
   super.Initialize(ba, EventName);
}

public void ShowAd() {

   
   AdInterstitialView interstitialView = new AdInterstitialView(ba.activity, Zone_Id);
   interstitialView.setShowCloseButtonTime(2);
   interstitialView.setAutoCloseInterstitialTime(5);
   interstitialView.show();
}
}

I do have the necessary jar files, i have the android.jar file and B4AShared.jar the Core.jar and of course the TapItAdView.jar.

help anyone!!!!
 

walterf25

Expert
Licensed User
Longtime User
Upvote 0
Top