0

I built an app Have a Many Layout. I run the app in my MOTO G3 and it runs perfectly but when I run it in other devices it crashes with this error:

 java.lang.NoClassDefFoundError: com.example.bylyngo

Here's the code:

private PagerAdapter mPagerAdapter = new PagerAdapter() {


        @Override
        public boolean isViewFromObject(View arg0, Object arg1) {
            return ((MySubscriber) arg1).getView() == arg0;
        }

        @Override
        public int getCount() {
            return mSubscribers.size();
        }

        @Override
        public CharSequence getPageTitle(int position) {
            if (position < mSubscribers.size()) {
                return mSubscribers.get(position).getName();
            } else {
                return null;
            }
        }
      .....
      ...
 }

I got the error at the first line:

private PagerAdapter mPagerAdapter = new PagerAdapter() {}

Please help me solve this silly problem.

Here is build.gradle(module)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "id_app"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jniLibs.srcDir 'jniLibs'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    defaultConfig {
        multiDexEnabled false
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:7.8.0'

}
RushDroid
  • 1,570
  • 3
  • 21
  • 46
  • The OpenTok library isn't installed on those devices...? – JHH Sep 03 '15 at 12:57
  • its installed And This is my Mysession Class which Located at Com.example.bylyngo.OpenTok @JHH – RushDroid Sep 03 '15 at 13:00
  • 1
    https://en.wikipedia.org/wiki/Capitalization_in_English – 2Dee Sep 03 '15 at 13:06
  • if you can't able to solve this problem than don't comment on post@2Dee Because i don't need Capitalization suggestion i need solution@2Dee – RushDroid Sep 03 '15 at 13:09
  • @Rushabh042 i'm happy you found the answer, but i wanted to point out that its a bad idea to incorporate the OpenTok Server SDK into your Android application (client). This would mean that you are shipping code which has your secret embedded. I think its fine for prototyping and learning, but you should remove this before you go to production. – Ankur Sep 08 '15 at 00:53

2 Answers2

1

This is most likely a problem with your compilation or packaging settings. See: Why am I getting a NoClassDefFoundError in Java?

There isn't enough information in your post to help debug the compilation. Can you provide details about what tools and the settings you are you using to produce the end Android apk?

Community
  • 1
  • 1
Ankur
  • 2,792
  • 3
  • 23
  • 26
0

After lots of search and wasting time i got Solution From this link.Thanks to this man For Right Ans. java.lang.NoClassDefFoundError: android.support.v4.view.LayoutInflaterCompatHC in Android Studio

Community
  • 1
  • 1
RushDroid
  • 1,570
  • 3
  • 21
  • 46