[SOLVED] SDKBox review plugin not working in android

[SOLVED] SDKBox review plugin not working in android
0.0 0

#1

I am getting this error the stack trace.

10-25 23:56:30.779 23519-23680/com.playpower.bb E/TrackingInfo﹕ reqAdvertisingIdentifier Error:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient;
10-25 23:56:31.549 23519-23519/com.playpower.bb E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.playpower.bb, PID: 23519
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/sdkbox/plugin/review/R$string;
at org.codechimp.apprater.AppRater.getPromptTitle(AppRater.java:427)
at org.codechimp.apprater.AppRater.showRateAlertDialog(AppRater.java:298)
at org.codechimp.apprater.AppRater.tryShowDialog(AppRater.java:223)
at com.sdkbox.plugin.PluginReview$1.run(PluginReview.java:55)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5234)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.sdkbox.plugin.review.R$string” on path: DexPathList[[zip file “/data/app/com.playpower.bb-2/base.apk”],nativeLibraryDirectories=[/data/app/com.playpower.bb-2/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at org.codechimp.apprater.AppRater.getPromptTitle(AppRater.java:427)
at org.codechimp.apprater.AppRater.showRateAlertDialog(AppRater.java:298)
at org.codechimp.apprater.AppRater.tryShowDialog(AppRater.java:223)
at com.sdkbox.plugin.PluginReview$1.run(PluginReview.java:55)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5234)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Suppressed: java.lang.ClassNotFoundException: com.sdkbox.plugin.review.R$string
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
… 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available


[SOLVED] java.lang.NoClassDefFoundError with review plugin (sdkbox)
#2

review plugin version v1.3.1.8
cocos2d-x-3.8.1

please help!

Its working on iOS


#3

Hi, Can you update to the 1.4 version and let me know how this works for you?


#4

Okay I will try and let you know


#5

i run cocos new to create a cpp 3.8.1 project,
and run sdkbox import review to import review plugin,
and cocos run, the prompt will show, work fine.

and from your log, the plugin can’t find R.string
you should check if plugin_review_res_project is exist under the path proj.android,
and if you project reference plugin_review_res_project


#6

Let us ask @nite to help with this.

Is there a log from the sdkbox import review command?


#7

I’ve got some issues with review plugin:

downloading package sdkbox-review_v1.5.3.3.tar.gz
[###################################] 100%
 [Errno 2] No such file or directory: 'C:\\CocosProjects\\Kelimece\\cocos2d\\cocos\\platform\\android\\java\\libs\\facebook_lib\\src\\org\\cocos2dx\\lib\\Cocos2dxActivity.java'
 Installation failed :(

Cocos2d-X 3.9 c++.

I’ve got C:\CocosProjects\Kelimece\cocos2d\cocos\platform\android\java\libs\facebook_lib\src\com\cocos2dx\lib\Cocos2dxActivity.java instead.

P.S: Right before trying to install review plugin, i updated sdkbox and facebook plugin.

Here is sdkbox -vv import review:

C:\CocosProjects\Kelimece>sdkbox -vv import review
  _______ ______  _     _ ______   _____  _     _
  |______ |     \ |____/  |_____] |     |  \___/
  ______| |_____/ |    \_ |_____] |_____| _/   \_
 Copyright (c) 2015 Chukong Technologies Inc. v0.5.8.15
 Namespace(alwaysupdate=0, china=0, command='import', days=10, dryrun=None, forcecopy=0, forcedownload=0, info=None, installer='C:/CocosProjects/Kelimece/sdkbox.pyc', jsonapi=0, local=0, manifest='manifest.json', mkey=None, mvalue=None, nohelp=0, nopatching=0, nopatchingcpp=0, noupdate=0, patcherrors=0, plugin='review/', project='C:/CocosProjects/Kelimece/', remote=0, server='download.sdkbox.com/installer/v1/', symbol=None, verbose=2)
 cache time out: 24
 get cache data len: 18913
 playphone scientificrevenue valuepotion chartboost kochava googleanalytics soomlagrow review googleplayservices anysdk fyber achievement agecheq iap leaderboard flurryanalytics inmobi vungle SDKBOX tune youtube appodeal bee7 facebook adcolony
 cocos2d-x installation directory C:/cocos2d-x-3.9/
 cocos2d-x header directory C:/cocos2d-x-3.9/cocos/
 cocos2d-x installation version 3.8.0
 looking for cocos2d.h at C:/CocosProjects/Kelimece/cocos2d/cocos
 cocos2d-x project root C:/CocosProjects/Kelimece/
 fallback to cocos project search False
 cocos2d-x project type cpp
 loaded package manifest
 loaded cocos project
 iOS project dirs ['C:/CocosProjects/Kelimece/proj.ios_mac']
 failed to load xcode project
 loaded android project
 load android studio project
 supported projects cocos android android studio
 package base name review
 skipping download of sdkbox-review_v1.5.3.3.tar.gz, already exists as C:/Users/DeathStar/.sdkbox/plugins/sdkbox-review_v1.5.3.3/
 setting plugin source to C:/Users/DeathStar/.sdkbox/plugins/sdkbox-review_v1.5.3.3/
 SHA1 of downloaded package 10e0c1c8b5c1ec6ccab2d7a8cf2455dae58d5c5a
 package base name review
 skipping download of sdkbox-review_v1.5.3.3.tar.gz, already exists as C:/Users/DeathStar/.sdkbox/plugins/sdkbox-review_v1.5.3.3/
 setting plugin source to C:/Users/DeathStar/.sdkbox/plugins/sdkbox-review_v1.5.3.3/
 SHA1 of downloaded package 10e0c1c8b5c1ec6ccab2d7a8cf2455dae58d5c5a
 adding to backup .sdkbox_packages.json.rfH2ZBMy.sdkbox.temp as C:/CocosProjects/Kelimece/.sdkbox_packages.json
 adding to backup Android.mk.kL9GgyON.sdkbox.temp as C:/CocosProjects/Kelimece/proj.android/jni/Android.mk
 adding to backup Application.mk.ByezHWnh.sdkbox.temp as C:/CocosProjects/Kelimece/proj.android/jni/Application.mk
 adding to backup AndroidManifest.xml.ujCpsFQg.sdkbox.temp as C:/CocosProjects/Kelimece/proj.android/AndroidManifest.xml
 adding to backup project.properties.nvd5QO8b.sdkbox.temp as C:/CocosProjects/Kelimece/proj.android/project.properties
 found sdkbox.package at C:/Users/DeathStar/.sdkbox/plugins/sdkbox-review_v1.5.3.3/plugin/sdkbox.package
 defining constant SDKBOX_PLUGIN_NAME=>Review
 checking patch status of file Cocos2dxActivity.java against patch Cocos2dxActivity.java.3.8.patch
 preprocessing patch Cocos2dxActivity.java.3.8.patch into Cocos2dxActivity.java.3.8.patch.feIXMzaV.sdkbox.temp
 crlf: 4  lf: 0  cr: 0   - file: src/org/cocos2dx/lib/Cocos2dxActivity.java hunk: 1
 crlf: 8  lf: 0  cr: 0   - file: src/org/cocos2dx/lib/Cocos2dxActivity.java hunk: 2
 crlf: 26  lf: 0  cr: 0  - file: src/org/cocos2dx/lib/Cocos2dxActivity.java hunk: 3
 crlf: 30  lf: 0  cr: 0  - file: src/org/cocos2dx/lib/Cocos2dxActivity.java hunk: 4
 crlf: 40  lf: 0  cr: 0  - file: src/org/cocos2dx/lib/Cocos2dxActivity.java hunk: 5
 crlf: 47  lf: 0  cr: 0  - file: src/org/cocos2dx/lib/Cocos2dxActivity.java hunk: 6
 -  6 hunks for src/org/cocos2dx/lib/Cocos2dxActivity.java
 total files: 1  total hunks: 6
Traceback (most recent call last):
  File "monolith.py", line 7967, in <module>
  File "monolith.py", line 7942, in main
  File "monolith.py", line 6335, in perform
  File "monolith.py", line 6944, in main
  File "monolith.py", line 6335, in perform
  File "monolith.py", line 7645, in cmd_import
  File "C:/Users/DeathStar/.sdkbox/plugins/sdkbox-review_v1.5.3.3/plugin/sdkbox.package", line 49, in <module>
    sdkbox.apply_patch(ANDROID_COCOS_SRC_DIR + 'Cocos2dxActivity.java', root=ANDROID_COCOS_PACKAGE_ROOT)
  File "monolith.py", line 5971, in apply_patch
  File "monolith.py", line 7199, in can_patch_file
  File "monolith.py", line 5414, in has_patched
  File "monolith.py", line 5445, in _match_file_hunks
IOError: [Errno 2] No such file or directory: 'C:\\CocosProjects\\Kelimece\\cocos2d\\cocos\\platform\\android\\java\\libs\\facebook_lib\\src\\org\\cocos2dx\\lib\\Cocos2dxActivity.java'
 Performing at_exit cleanup.
 Tracking: {'cocos_installation': '3.8.0', 'sdkbox_version': '0.5.8.15', 'cocos': '3.7.0', 'args': {'verbose': 2, 'installer': 'C:/CocosProjects/Kelimece/sdkbox.pyc', 'manifest': 'manifest.json', 'nopatching': 0, 'patcherrors': 0, 'project': 'C:/CocosProjects/Kelimece/', 'noupdate': 0, 'mvalue': None, 'nopatchingcpp': 0, 'local': 0, 'nohelp': 0, 'dryrun': None, 'jsonapi': 0, 'symbol': None, 'china': 0, 'mkey': None, 'info': None, 'remote': 0, 'plugin': u'C:/Users/DeathStar/.sdkbox/plugins/sdkbox-review_v1.5.3.3/', 'forcecopy': 0, 'days': 10, 'server': 'download.sdkbox.com/installer/v1/', 'forcedownload': 0, 'command': 'import', 'alwaysupdate': 0}, 'return_status': None}

And symbols:

SDKBOX installer script symbols:
     ANDROID_ACTIVITY_NAME              AppActivity
     ANDROID_ACTIVITY_PATH              C:/CocosProjects/Kelimece/proj.android/src/org/cocos2dx/cpp/
     ANDROID_COCOS_PACKAGE_ROOT         C:/CocosProjects/Kelimece/cocos2d/cocos/platform/android/java/libs/facebook_lib/
     ANDROID_COCOS_SRC_DIR              C:/CocosProjects/Kelimece/cocos2d/cocos/platform/android/java/libs/facebook_lib/src/org/cocos2dx/lib/
     ANDROID_JNI_DIR                    C:/CocosProjects/Kelimece/proj.android/jni/
     ANDROID_LIBS_DIR                   C:/CocosProjects/Kelimece/cocos2d/cocos/platform/android/java/libs/facebook_lib/libs/
     ANDROID_MANIFEST                   C:/CocosProjects/Kelimece/proj.android/AndroidManifest.xml
     ANDROID_MK                         C:/CocosProjects/Kelimece/proj.android/jni/Android.mk
     ANDROID_MK_USES_WILDCARDS          False
     ANDROID_PROJECT_DIR                C:/CocosProjects/Kelimece/proj.android/
     ANDROID_PROPERTIES                 C:/CocosProjects/Kelimece/proj.android/project.properties
     ANDROID_SDK_DIR                    C:/adt-bundle-windows-x86_64-20140702/sdk/
     ANDROID_STUDIO_ACTIVITY_NAME       AppActivity
     ANDROID_STUDIO_ACTIVITY_PATH       C:/CocosProjects/Kelimece/proj.android-studio/app/src/org/cocos2dx/cpp/
     ANDROID_STUDIO_JNI_DIR             C:/CocosProjects/Kelimece/proj.android-studio/app/jni/
     ANDROID_STUDIO_LIBS_DIR            C:/CocosProjects/Kelimece/cocos2d/cocos/platform/android/libcocos2dx/libs/
     ANDROID_STUDIO_MANIFEST            C:/CocosProjects/Kelimece/proj.android-studio/app/AndroidManifest.xml
     ANDROID_STUDIO_MK                  C:/CocosProjects/Kelimece/proj.android-studio/app/jni/Android.mk
     ANDROID_STUDIO_MK_USES_WILDCARDS   False
     ANDROID_STUDIO_PROJECT_DIR         C:/CocosProjects/Kelimece/proj.android-studio/
     ANDROID_STUDIO_PROPERTIES          C:/CocosProjects/Kelimece/proj.android-studio/app/project.properties
     APPLICATION_MK                     C:/CocosProjects/Kelimece/proj.android/jni/Application.mk
     COCOS_2DX_INSTALLATION_VERSION     3.8.0
     COCOS_2DX_ROOT                     C:/cocos2d-x-3.9/
     COCOS_2DX_VERSION                  3.7.0
     COCOS_BACKUP_DIR                   C:/CocosProjects/Kelimece/backup-2016-01-20/
     COCOS_CLASSES_DIR                  C:/CocosProjects/Kelimece/Classes/
     COCOS_ENGINE_TYPE                  unknown
     COCOS_PROJECT_DIR                  C:/CocosProjects/Kelimece/
     COCOS_PROJECT_HINT                 C:/CocosProjects/Kelimece/
     COCOS_PROJECT_TYPE                 cpp
     COCOS_RESOURCES_DIR                C:/CocosProjects/Kelimece/Resources/
     IOS_PROJECT_DIR                    C:/CocosProjects/Kelimece/proj.ios_mac/
     SDKBOX_DIR                         C:/Users/DeathStar/.sdkbox/
     XCODE_PROJECT                      C:/CocosProjects/Kelimece/proj.ios_mac/project.pbxproj
     XCODE_PROJECT_DIR                  C:/CocosProjects/Kelimece/proj.ios_mac/

#8

Hi @hgokturk

Let me check this.


#9

Hello @hgokturk

Could you please check with the sample now whether it works for you.
https://github.com/sdkbox/sdkbox-sample-review

Best,
Pabitra


#10

Hi @pabitrapadhy. Thank you for your help but i can’t install the plugin; not that the successfuly installed review isn’t working.


#11

Okay, I will let you know in another one hour. :smile:
I am checking it currently.


#12

Hi @hgokturk

Sorry, a little late.
But, it seems to work fine to me.

Just the exact same code as in sample would work, just you need to make some changes.
currently I am not depending on the sdkbox_config.json data to invoke the rate popup, instead I am calling it forcefully.

Here’s the code -

#include "HelloWorldScene.h"

#include "cocostudio/CocoStudio.h"
#include "PluginReview/PluginReview.h"


USING_NS_CC;

class PluginReviewListenerCpp: public sdkbox::ReviewListener {
public:
    virtual void onDisplayAlert() {
        CCLOG("reivew dialog show");
    };
    virtual void onDeclineToRate() {
        CCLOG("user decline to rate my app");
    };
    virtual void onRate() {
        CCLOG("user did rate my app");
    };
    virtual void onRemindLater() {
        CCLOG("user want be remind later");
    };
};

Scene* HelloWorld::createScene()
{
    // 'scene' is an autorelease object
    auto scene = Scene::create();

    // 'layer' is an autorelease object
    auto layer = HelloWorld::create();

    // add layer as a child to scene
    scene->addChild(layer);

    // return the scene
    return scene;
}

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    auto closeItem = MenuItemImage::create(
                                           "CloseNormal.png",
                                           "CloseSelected.png",
                                           CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));

	closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
                                origin.y + closeItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    auto menu = Menu::create(closeItem, NULL);
    menu->setPosition(Vec2::ZERO);
    this->addChild(menu, 1);


    FileUtils::getInstance()->addSearchPath("res/Default/");


    sdkbox::PluginReview::setTitle("Please Rate Our App");
    sdkbox::PluginReview::setMessage("If you liked our app, please take a moment of your time to rate us.");
    sdkbox::PluginReview::setCancelButtonTitle("Never");
    sdkbox::PluginReview::setRateButtonTitle("Rate Now");
    sdkbox::PluginReview::setRateLaterButtonTitle("Rate Later");


    sdkbox::PluginReview::init();
    sdkbox::PluginReview::setListener(new PluginReviewListenerCpp());

    sdkbox::PluginReview::show(true);

    auto label = Label::createWithTTF("The rate prompt will show, when 3rd launch", "fonts/arial.ttf", 12.0f);
    label->setPosition(Vec2(visibleSize.width/2, visibleSize.height/2));
    this->addChild(label);



    return true;
}


void HelloWorld::menuCloseCallback(Ref* pSender)
{
    Director::getInstance()->end();

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    exit(0);
#endif
}

Just replace the contents of HelloWorldScene.cpp with this.
I have also tried to import the plugin and test and that seems to work fine for me also.

Suggestions :

Please update to the latest version of the SDKBOX plugins v1.5.3.3

Best,
Pabitra


#13

Hi @pabitrapadhy,
Because PluginReview is not installed, PluginReview.h can not be included in my project.

Copyright (c) 2015 Chukong Technologies Inc. v0.5.8.15
 1.5.3.3 1.5.3.3
 1.5.3.3 1.5.3.3
 1.5.3.3 1.5.3.3
 1.5.3.3 1.5.3.3
 all packages are up to date. 

And sdkbox is up to date.


#14

Hello,

Please go inside your project root directory and try to run this command -

sdkbox import review

it will install the review plugin from SDKBOX into your project.
If your sdkbox installer is not installed then first run this python script -

python -c "import urllib; s = urllib.urlopen('https://raw.githubusercontent.com/sdkbox-doc/en/master/install/install.py').read(); exec s"

then run the command - sdkbox import review

I believe you had not installed the review plugin, that’s why it was not working.


#15

Yes, exactly. That’s what i can’t do my friend :slight_smile: I’m unable to install Review plugin although i have sdkbox properly installed :slight_smile:


#16

That’s strange.

I tried to create a new project and import it worked fine for me.
Just one last time could you make sure that you are checking this with a new project please… !!

Also, could you let me know which version of cocos2dx you are using… !! :smile:


#17

Yes with a new project it works. But i have to add it to my current project, you know :slight_smile:
Cocos2d-x 3.8


#18

Okay. that’s great.

Surely, I will help you in adding this to your project.
Just to simulate your project, if I may know what all plugins are your using and in which order had you added them.

I see FB is there, is there any other plugin,
let me know, I will check this in detail and let you know tomorrow.
It’s past 4 in night here… ha ha… :smile:


#19

Before attemt on installing review plugin, i had only facebook plugin which i think causes the mess. But now i have also google analytics plugin installed and good night :slight_smile:


#20

Okay, I will let you know tomorrow. :smile:

Best,
Pabitra