No Such Field Error Android
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn java.lang.nosuchfielderror android studio more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
No Such Field Error Instance
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you,
No Such Field Error In Java
helping each other. Join them; it only takes a minute: Sign up Android java.lang.NoSuchFieldError up vote 4 down vote favorite 1 In some case, when accessing an activity field from an anonymous class, I get NoSuchFieldError at runtime:
Java.lang.nosuchfielderror: No Static Field Of Type I In Class
java.lang.NoSuchFieldError: MyActivity.myField EDIT: I'm now sure that it's an Android issue, because everything compiles correctly but resolved incorrectly at runtime. When changing to MyActivity.this.myField instead of plain myField, everything works perfect. BTW, I rechecked and I don't have any other myField anywhere else, Also, when opening declaration in Eclipse, it goes to the intended field (myField). The only problem is that I couldn't reproduce this in a sample project. I'm left only to state that it's a android studio no such instance field specific problem in my project, but I'm reluctant doing so and I can't publish this project. I'll keep this open in case someone stumbles upon something similar. Here's the code that I can publish that crashes my project but not the sample one: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new Runnable() { @Override public void run() { Toast.makeText(MyActivity.this, myField.getName(), Toast.LENGTH_SHORT).show(); } }.run(); } android share|improve this question edited Apr 4 '14 at 9:38 yochannah 2,11352042 asked Jun 16 '12 at 14:36 AlikElzin-kilaka 11.3k1178111 Whoever votes this down, please explain the reason so I can provide a better question. –AlikElzin-kilaka Jun 16 '12 at 14:38 no idea ?..but please provide code.......... –Dheeresh Singh Jun 16 '12 at 14:38 1 you have down vote(i didn't) maybe because you didn't add code for example and without code we are able to do anything. –Sajmon Jun 16 '12 at 14:39 Writing a sample code to reproduce... –AlikElzin-kilaka Jun 16 '12 at 14:46 I can't create a project that reproduces this. It happens only on my project. I guess it's my fault but I can't publish this project. Bummer. –AlikElzin-kilaka Jun 16 '12 at 19:08 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted It seems that accessing the field with the class' prefix solves it
and DropEventsExpandableListViewGridViewHorizontalScrollViewImageButtonImageViewLinearLayoutListViewNotificationsPasswordProgressBarProgressDialogRadioButtonRadioGroupRatingBarRelativeLayoutScrollViewSelectorSettingsSpinnerSurfaceViewTextBoxTimePickerToastToggleButtonWebViewviewMenuOnClickListenerViewPagerwidgetAutoCompleteTextViewEditTextFrameLayoutSeekBarSlidingDrawerStackViewTextViewViewFlipperxmlgamescanvasmain loopOpenGL ESCore JavaanimationapacheANTcommonsbeanutilsconvertersArrayConvertercliBasicParsercodecbinaryBase64Base64OutputStreamcsvdbcpBasicDatasourcePoolingConnectioniocomparatorCompositeFileComparatorDirectoryFileComparatorLastModifiedFileComparatorNameFileComparatorPathFileComparatorFilenameUtilsFileUtilsIOUtilsmonitorFileAlterationMonitorlang3CharUtilsClassPathUtilsmathFractionNumberUtilsStringUtilsloggingLogfactorynetCookieStoreFTPClientURLClassLoaderURLConnectionluceneappletaspectjbeanscajoCharacterclassComperablecryptoDesign PatternsdecoratorstrategyGenericsGradlegsonGsonBuilderstreamJsonReaderJsonWriterioBufferedInputStreamBufferedOutputStreamBufferedReaderBufferedWriterByteArrayInputStreamByteArrayOutputStreamConsoleDataInputStreamDataOutputStreamExternalizableFileFileDescriptorFileInputStreamFilenameFilterFileOutputStreamFileReaderFileWriterInputStreamInputStreamReaderIOExceptionObjectInputStreamObjectOutputStreamOutputStreamPrintWriterRandomAccessFileSerializableStreamTokenizerStringReaderStringWriterjsonJacksonJSON.SimplejunitlangmanagementNumberFormatExceptionProcessBuilderReferen
at startup: java.lang.NoSuchFieldError: Discussion in 'Android Questions' started by Dave61, Mar 16, 2016. Similar threadsB4A Tutorial Make your app compatible with Android 5.0 devicesB4A Library AppCompat - Make Material Design apps compatible with older Android versionsB4A Question [RESOLVED] Android SDK 30B4A Tutorial Material Design 2 - Using the AppCompat libraryB4A Question App crashing on 4.4 - AppCompat Vector Drawables Dave61 Member Licensed User I loaded up my B4A application source code after not working on it for some time and just updating B4A 5.50 to 5.80 this evening. When I load it over to my phone I get a crash that looks like this in the Logs: java.lang.NoSuchFieldError: No static field Theme of type [I in class Landroid/support/v7/appcompat/R$styleable; or its superclasses (declaration of 'android.support.v7.appcompat.R$styleable' appears in /data/app/example.tablayout.customtabs-1/base.apk) at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:306) at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:279) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:244) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:114) at example.tablayout.customtabs.main.onCreate(main.java:59) at android.app.Activity.performCreate(Activity.java:6550) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3108) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3263) at android.app.ActivityThread.access$1000(ActivityThread.java:197) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1687) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6897) 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:1404) at com.android.internal.os.ZygoteInit.main(Zygo