Java Question try to make libraries for appwiz

hanyelmehy

Active Member
Licensed User
Longtime User
Hi,
i try to make libraries for appwiz
this is the original instruction
B4X:
Add to Code
Go to your main class activity (the one which has android.intent.action.MAIN marked in the
manifest) and import the SDK package in:
import com.analitics.api.AppwizSDK;
import com.analitics.api.OnEulaScreenClosedHandler;
- Call the static function in the beginning of the 'onCreate' function of that
activity:
AppwizSDK.init(this, new OnEulaScreenClosedHandler()
{
/**
* This function takes place, once the user passes the EULA screen
* eulaResult possible values: Accepted = 0 Skipped = 1 Already Accepted = 3 Error = 4
*/
@Override
public void continueToApp (int eulaResult)
{
//Put you code here to continue to app
}
});

AppwizSDK.startOfferWall(Context);
- To start Offerwall call the following method:
AppwizSDK.startOfferWall(Context);
- To start PremiumAd call the following method:
AppwizSDK.startPremiumAd(Context);

And This is My library

B4X:
package b4a.appwiz.lib;
import android.app.Activity;
import android.content.Context;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.Events;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.DontInheritEvents;
import anywheresoftware.b4a.objects.ViewWrapper;

import com.analitics.api.AppwizSDK;
import com.analitics.api.OnEulaScreenClosedHandler;

@ActivityObject
@Author("Hany Elmehy")
@ShortName("AppWizLib")
@Version(1)

public class appwizlib {
 
     private BA myba;
     public void Initialize(BA ba)
    {
       
        myba = ba;  
        
        AppwizSDK.init(myba.context, new OnEulaScreenClosedHandler()
        {
        /*
        * This function takes place, once the user passes the EULA screen
        * eulaResult possible values: Accepted = 0 Skipped = 1 Already Accepted = 3 Error = 4
        */
        @Override
        public void continueToApp (int eulaResult)
        {
        //Put you code here to continue to app
         
        }
        });
   
    }
     
     public void StartOfferwall()
       {
          AppwizSDK.startOfferWall(myba.context);
          
        } 

     public void StartPremiumAd()
       {
          AppwizSDK.startPremiumAd(myba.context);
          
        } 
     
}

i get this error when try to use (Initialize)

B4X:
main_activity_create (B4A line: 30)


APWiz.Initialize
java.lang.NoClassDefFoundError: b4a.appwiz.lib.appwizlib$1
   at b4a.appwiz.lib.appwizlib.Initialize(appwizlib.java:29)
   at b4a.example.main._activity_create(main.java:249)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
   at b4a.example.main.afterFirstLayout(main.java:89)
   at b4a.example.main.access$100(main.java:16)
   at b4a.example.main$WaitForLayout.run(main.java:74)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:3647)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
   at dalvik.system.NativeStart.main(Native Method)
Any suggestions:sign0085:
Thank you
 

hanyelmehy

Active Member
Licensed User
Longtime User
It looks like you might be missing an @DependsOn(values = { "whatever" }) attribute as I guess you are referencing an external jar.

can you please explain this in more details ,i can't find referencing to any external jar
Thank you
 

barx

Well-Known Member
Licensed User
Longtime User
have you copied the sdk files to your b4a additional libraries folder?
 

agraham

Expert
Licensed User
Longtime User
pleas try this link
No, I meant in your project! Have you incorporated the source code in your library or are you using it in a separate jar.

However from that link I see that it is a separate jar so I assume that you have it referenced in your project build path or your project would not compile. The problem is as I have already said above. You need to copy the AppwizSDK_v1.4.7.jar together with your library to your Additional Libraries folder and add
@DependsOn(values = { "AppwizSDK_v1.4.7" }
to your project attributes.
 

hanyelmehy

Active Member
Licensed User
Longtime User
No, I meant in your project! Have you incorporated the source code in your library or are you using it in a separate jar.

However from that link I see that it is a separate jar so I assume that you have it referenced in your project build path or your project would not compile. The problem is as I have already said above. You need to copy the AppwizSDK_v1.4.7.jar together with your library to your Additional Libraries folder and add
@DependsOn(values = { "AppwizSDK_v1.4.7" }
to your project attributes.

i well try ,thank you for your time:icon_clap:
 

Theera

Well-Known Member
Licensed User
Longtime User
i well try ,thank you for your time:icon_clap:

Hi hanyelmehy,
Could you do it finish ? Now I'm interested in this topic "Creating wrappers for 3rd party SDKs " as same as yours.

P.S. your example could help me understand more (I need a new example).
 
Last edited:
Top