There's two android projects I want to merge, one is Main and the other is linked as Library.
But I have some troubles on this line:
Button modificarC;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_menu_calificaciones);
modificarC = (Button) findViewById(R.id.btn_aseso); //HERE
I tried Project Clean... also I have android-support-v4.jar on my dependencies
And this is my trace:
04-24 19:39:52.568: E/AndroidRuntime(9486): FATAL EXCEPTION: main
04-24 19:39:52.568: E/AndroidRuntime(9486): java.lang.NoSuchFieldError: com.utez.sistemas.sam.R$id.btn_aseso
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.utez.sistemas.sam.calificaciones.CalificacionesActivity.onCreate(CalificacionesActivity.java:67)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.Activity.performCreate(Activity.java:4465)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.access$600(ActivityThread.java:127)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.os.Looper.loop(Looper.java:137)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.main(ActivityThread.java:4507)
04-24 19:39:52.568: E/AndroidRuntime(9486): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 19:39:52.568: E/AndroidRuntime(9486): at java.lang.reflect.Method.invoke(Method.java:511)
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
04-24 19:39:52.568: E/AndroidRuntime(9486): at dalvik.system.NativeStart.main(Native Method)
Also here is the layout:
<LinearLayout
style="#style/LoginFormContainer"
android:layout_width="253dp"
android:layout_height="260dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="30dp"
android:orientation="vertical" >
<Button
android:id="#+id/btn_alta"
android:layout_width="match_parent"
android:layout_height="63dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:background="#drawable/btn_altacalif"
android:contentDescription="#string/action_sign_in_register"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:textAlignment="center" />
<Button
android:id="#+id/btn_aseso"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:layout_weight="0.16"
android:background="#drawable/btn_modcalif"
android:contentDescription="#string/action_sign_in_register"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:textAlignment="center" />
</LinearLayout>
I had the same error and it turns out that the resource was overridden.
If you have one project working as a library that declares some id in a given XML file,
then your main project redefines that XML, the original id is gone, but you won't see the error until run time.
In my case, a partner deleted and committed the XML from the project, then added it back in the library project. Subclipse didn't seems to notice that because I was up to date, but the XML was there on the main project.
Well, I am Chinese. My English is not good.
I got the question too.
The solution may be:
The name of xml file is repeated, eg:a.xml is in your library project, at the same time, a.xml is in your main project.
so, please change one of the xml name.
To elaborate on #Moxor's solution, you can either:
Decalare a dummy layout xml, and assign the missing ids to some dummy Views.
Declare the missing ids as resources, the same way you declare a string resource: http://developer.android.com/guide/topics/resources/more-resources.html#Id
Cleaning the project worked for me.
Related
I have an android app that was working previously, I had to set up the dev environment on a new PC. Everything compiles fine (i'm using Android Studio), but I get the following error:
11-26 15:25:22.737 15132-15132/com.sample E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gcm.GCMRegistrar
at com.sample.views.loginregistration.LoginManager.handleRegistration(LoginManager.java:147)
at com.sample.views.loginregistration.LoginViewFragment.onCreateView(LoginViewFragment.java:74)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:523)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5143)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
It's saying it cannot find gcm.jar which is clearly in the project and in a folder called libs. These were the common issues that people reported in other SO posts. The app basically launches and then crashes on the spot... But i'm confused as the setup is correct.
Is there anything else that could be wrong with this?
It might be a build.gradle issue. You should have this in your build.gradle file
dependencies {
compile files('libs/gcm.jar')
}
Once you've added that, go to Tools -> Android -> Sync Project with Gradle Files
I am trying to generate QRCode image using QRGen library.
I have imported qrgen-1.0.jar file to my project.
I know this question is duplicate.
I have referred following code by this link
public Bitmap qrBitmapFromString(String qrText){
ByteArrayOutputStream out = QRCode.from(qrText).to(ImageType.PNG).withSize(300, 300).stream();
byte[] data = out.toByteArray();
Bitmap bmp = BitmapFactory.decodeByteArray (data,0,data.length, null);
return bmp;
}
But I am getting the following error.
04-24 11:48:57.138: E/AndroidRuntime(824): FATAL EXCEPTION: main
04-24 11:48:57.138: E/AndroidRuntime(824): java.lang.NoClassDefFoundError: net.glxn.qrgen.QRCode
04-24 11:48:57.138: E/AndroidRuntime(824): at com.example.barcodeexample.QRCodeGeneratorActivity.onCreate(QRCodeGeneratorActivity.java:34)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.Activity.performCreate(Activity.java:5008)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.os.Looper.loop(Looper.java:137)
04-24 11:48:57.138: E/AndroidRuntime(824): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-24 11:48:57.138: E/AndroidRuntime(824): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 11:48:57.138: E/AndroidRuntime(824): at java.lang.reflect.Method.invoke(Method.java:511)
04-24 11:48:57.138: E/AndroidRuntime(824): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-24 11:48:57.138: E/AndroidRuntime(824): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-24 11:48:57.138: E/AndroidRuntime(824): at dalvik.system.NativeStart.main(Native Method)
I have imported
import net.glxn.qrgen.QRCode;
import net.glxn.qrgen.image.ImageType;
2.0-SNAPSHOT should solve this https://oss.sonatype.org/content/repositories/snapshots/net/glxn/qrgen/android/2.0-SNAPSHOT/
https://github.com/kenglxn/QRGen
Finally I found and following thing working well for me.
Right click on your project
Go into Build Path
Configure Build Path
Go to Order and Export
Check your OnBarcode library
Clean your project
Think this may help some one like me.
Thanks.
I'm continuing to dig through marketplace crash reports, and have come across another one which I can't make any sense of. The stack trace:
java.lang.RuntimeException: Binary XML file line #17: You must supply a layout_height attribute.
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5319)
at android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:5271)
at android.widget.AbsListView$LayoutParams.<init>(AbsListView.java:6398)
at android.widget.AbsListView.generateLayoutParams(AbsListView.java:6035)
at android.widget.AbsListView.generateLayoutParams(AbsListView.java:96)
at android.view.LayoutInflater.inflate(LayoutInflater.java:477)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.android.internal.view.menu.ListMenuPresenter$MenuAdapter.getView(ListMenuPresenter.java:253)
at android.widget.AbsListView.obtainView(AbsListView.java:2212)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)
at android.widget.ListView.onMeasure(ListView.java:1155)
at android.view.View.measure(View.java:12863)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2256)
at android.view.View.measure(View.java:12863)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1166)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2552)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
So I'm being told that layout_height is missing in one of my layout files on a line #17? But I don't know which layout file from the stack trace. I'm going through them one by one to see if I forgot the layout_height attribute anywhere, but I have lots of them and wanted to see if I'm missing something obvious here.
Currently for my 2.x preference screens, in every PreferenceActivity I add the line setContentView(R.layout.activity_preferences); to have a custom layout in my activities.
The activity_preferences.xml layout file looks like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout style="#style/TitleBar">
<ImageButton style="#style/TitleBarAction"
android:src="#drawable/ic_title_home"
android:onClick="onHomeClick" />
<ImageView style="#style/TitleBarSeparator" />
<eu.vranckaert.worktime.utils.view.CustomTextView
style="#style/TitleBarText" android:text="#string/lbl_preferences_title"/>
</LinearLayout>
<ListView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#android:id/list"/>
</LinearLayout>
For my 3.x and up application I am building the preferences according to the example over here: http://developer.android.com/reference/android/preference/PreferenceActivity.html.
In order to apply the same layout to my 3.x app, I tried was to add the setContentView(..) in the 3.x PreferenceActivity.
Result on phone: this works fine on the first activity, then when loading a fragment (with the real preferences in them) my style is not applied
Result on tablet: crash:
ERROR/AndroidRuntime(2208): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.vranckaert.worktime/eu.vranckaert.worktime.activities.preferences.PreferencesICSActivity}: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment TimeRegistrationsPreferencesFragment{4101ed38 #0 id=0x10202d4}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment TimeRegistrationsPreferencesFragment{4101ed38 #0 id=0x10202d4}
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:822)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
at android.app.BackStackRecord.run(BackStackRecord.java:622)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
at android.app.Activity.performStart(Activity.java:4474)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
... 11 more
When I try to apply the layout file on my fragments using getActivity().setContentView(R.layout.activity_preferences); the result is:
for phone: the activity is still shown fine, when going into a category it crashes:
ERROR/AndroidRuntime(1320): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.vranckaert.worktime/eu.vranckaert.worktime.activities.preferences.PreferencesICSActivity}: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment DateTimePreferencesFragment{412a0d78 #0 id=0x10202d4}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment TimeRegistrationsPreferencesFragment{412a0d78 #0 id=0x10202d4}
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:822)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
at android.app.BackStackRecord.run(BackStackRecord.java:622)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
at android.app.Activity.performStart(Activity.java:4474)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
... 11 more
for tablet: same crash as before...
How should I apply this layout file to my fragment activity...? Or should I create a new layout file?
04-24 13:30:59.312: VERBOSE/RenderScript(6044): RS Thread exited
04-24 13:30:59.320: ERROR/libEGL(6044): call to OpenGL ES API with no current context (logged once per thread)
04-24 13:30:59.335: WARN/WallpaperService(6044): Ignoring updateSurface: destroyed
04-24 13:30:59.335: WARN/WindowManager(108): Window android.view.IWindow$Stub$Proxy#408968d0 is already added
04-24 13:30:59.355: DEBUG/dalvikvm(6083): GC_EXTERNAL_ALLOC freed 23K, 52% free 2598K/5379K, external 1625K/2137K, paused 55ms
04-24 13:30:59.425: DEBUG/GLWallpaperService(6083): onSurfaceDestroyed()
04-24 13:30:59.496: WARN/InputQueue-JNI(6044): Input channel is not initialized.
04-24 13:30:59.515: DEBUG/AndroidRuntime(6044): Shutting down VM
04-24 13:30:59.539: WARN/dalvikvm(6044): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): FATAL EXCEPTION: main
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): java.lang.RuntimeException: Failed to register input channel. Check logs for details.
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at android.view.InputQueue.nativeRegisterInputChannel(Native Method)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at android.view.InputQueue.registerInputChannel(InputQueue.java:92)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at android.service.wallpaper.WallpaperService$Engine.updateSurface(WallpaperService.java:521)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:904)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at android.os.Looper.loop(Looper.java:123)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at java.lang.reflect.Method.invoke(Method.java:507)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-24 13:30:59.640: ERROR/AndroidRuntime(6044): at dalvik.system.NativeStart.main(Native Method)
I was developing a Livewallpaper which uses a open-source game engine called Andengine(andengine.org), it works fine now except sometimes when user set my Livewallpaper as wall paper, an Exception will be thrown saying "Failed to register input channel. Check logs for details.", but the werid thing is the Livewallpaper still works and did not exit.
Any idea what maybe causing this problem , or how I can fix it?
Sorry, I could only find that the InputQueue "provides a mechanism for an application to receive incoming input events. Currently only usable from native code".
Check the GLSurfaceView class in andengine. That may give you a clue of what is wrong with your wallpaper
You may also want to check why this is happening:
04-24 13:30:59.320: ERROR/libEGL(6044): call to OpenGL ES API with no current context (logged once per thread)