I've just started this evening into developing my first Android app and have come across an error that for the life of me I can't see where is coming from
When i launch my test app in the emulator it force closes with the error "The application Test App (psrocess Test.App) has stopped unexpectedly. Please try again."
So far I've checked: The Android Development output - nothing untoward,launches fine and locates activity and intent
The Emulator output - nothing reported at all
The TestApp debug - reports BUILD SUCCESSFUL
I proceeded to then examine the main.xml used for the layout and on validation in NetBeans it reports "cvc-elt.1: Cannot find the declaration of element 'LinearLayout'"
My main.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical" >
<Button
android:id="#+id/used_cars"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/used_cars" />
<Button
android:id="#+id/used_vans"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/used_vans" />
<Button
android:id="#+id/dealers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/dealers" />
</LinearLayout>
I've trawled for info on how to fix this and can't find an answer
Could someone be kind enough to please advise if i'm missing something fundamental?
Thanks in advance
Barry
I've went through the logcat info and found nothing so i decided to create a new app from scratch and copy over the info and it runs fine
If i do find any other info on what caused the issue i'll be sure to post it up
I can only put it down to a config error atm
Kind Regards
Barry
Related
I recently implemented Algolia on my app successfully just like the examples.
But the initial search takes about 5 to 7 seconds and I couldn't find a way to make it faster after checking the whole library code and documentation. After the initial search, search becomes very fast.
There is nothing unusual in my implementation but maybe you can see something that I don't. The following code is from the activity where I initialize Algolia:
Searcher searcher = new Searcher(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME);
searcher.setQuery(new Query("word").setExactOnSingleWordQuery(Query.ExactOnSingleWordQuery.ATTRIBUTE));
searcher.addNumericRefinement(new NumericRefinement("CountryId", NumericRefinement.OPERATOR_EQ, 1));
InstantSearch helper = new InstantSearch(this, searcher);
helper.setSearchOnEmptyString(false);
helper.search();
And this is the related xml layout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingRight="10dp"
android:paddingLeft="1dp"
android:paddingTop="6dp">
<com.algolia.instantsearch.ui.views.SearchBox
android:id="#+id/searchBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:queryHint="#string/search_text_hint"
algolia:searchIcon="#drawable/icn_search_big"
algolia:closeIcon="#drawable/icn_clear_filled_big"
android:queryBackground="#drawable/sarch_query_shape"
android:background="#drawable/search_shape"
algolia:autofocus="true"
algolia:submitButtonEnabled="false" />
</FrameLayout>`
<com.algolia.instantsearch.ui.views.Hits
android:id="#+id/hits"
android:layout_width="match_parent"
android:layout_height="match_parent"
algolia:autoHideKeyboard="true"
algolia:hitsPerPage="6"
android:layout_below="#+id/searchBarParentLayout"
algolia:infiniteScroll="false"
algolia:itemLayout="#layout/search_item_algolia_row"/>
Do you have any idea what can be the issue here?
I'm glad that the issue disappeared when you switched to another wifi.
For future readers that may encounter network issues with InstantSearch Android:
First of all, build and run one of our demo applications
If you see no problem running the example application, you can try using a proxy like Charles to investigate what's happening between your app and the network
If your problem persists when running the examples, or if you are following the documentation, send an email to support#algolia.com describing the issue with a sample of your code!
Android studio throws "Too much output to process error" on debug.
I just started working on android development and trying to debug using my nexus 5 as a connected device.
Being a novice, I thought it was a memory issue and even closed all the background applications. In my single activity I am just displaying a background image and a button.
Please have a look at the layout xml...
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/backgroundimage"
android:weightSum="5"
android:orientation="vertical">
<LinearLayout
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:background="#C9BDBD"
android:padding="5dp">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
</LinearLayout>
your Button's android:onClick should be a method in the Java code.
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
something like
android:onClick="doSomthing"/>
and in the Java code:
public void doSomthing(View v){
...
...
...
}
As far as "too much output..." issue is concerned, you can mostly ignore it. Still it would make sense if you remove some of the really unnecessary Log lines from your code, especially from methods that are called repeatedly and frequently.
Another thing, i believe you want to show a text "Congratulations!!! You are now initiated.." when user clicks on button.
So change your xml's android:onClick to android:onClick= "myButtonClicked"
In the activity, implement this function
public void myButtonClicked(){
}
Finally, show the text "Congratulations!!! You are now initiated.." either via dialog (e.g. alertDialog) or in some textView
You may have selected "No Filters" in android monitor which causes "Too much output to process error", Change it to "Show only selected Application" then all other Log line are filtered and will not show in Logcat.
I am on a project. My instructor has told me to use MigLayout to design the forms in android. I am finding it difficult to find proper examples and while Using Eclipse for development its showing errors that android perfix is required to use the attributes.
please help me with some examples..
code that i pasted from the source site,mig4android.
<com.saynomoo.mig4android.MigLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
layout_constraints="wrap 4, debug 1"
column_constraints="[]15[75px]25[min]25[]"
row_constraints="[]15"
>
<TextView android:text="label1" component_constraints="skip"/>
<TextView android:text="label2" />
<TextView android:text="label3" component_constraints="wrap"/>
<TextView android:text="label4" />
<TextView android:text="label5" component_constraints="wmin 30"/>
<TextView android:text="label6" component_constraints="wmin 30"/>
<TextView android:text="label7" component_constraints="wmin 30"/>
</com.saynomoo.mig4android.MigLayout>
The component_constraints gave the error
This error means you forget to add android word before any attribute in xml file.
For example-
id="#+id/my_location"
You need to write android before id like below.
android:id="#+id/my_location"
Your code is perfect. But "skip" in component_constraints appears to be ignored. I had to manually add place holder to the layout to "fill in" empty spots. I tried "skip 1" and that also had no impact.
For more information see following link.
Skip as a constraint is not working
i have the problem, that if i create a new layout and change the layout in the graphical layout for example add a button or a textfield to the layout, that the application canĀ“t be installed on the emulated device. I get the unusable error "Failed to install *.apk on device 'emulator-5556': timeout
Launch canceled!".
If i remove the button or textfield then the emulator runs the application. I tested many things. I removed Eclipse and the Android SDK. Installed different Versions of the Eclipse Software (Classic, JAVAEE) and then installed the android SDK every time new. Nothing changed. I deleted the .android folder in my Windows Userprofile. But nothing changed.
What is wrong.
The Code of my layout:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
the code of the Activity:
package de.androidpraxis.HelloAndroid;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndroidActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
}
}
i hope someone can help me. Thanks in advance.
greetings
edit:
I found something out. I have a project with a standard layout and an folder for land-layout. If i delete the land-layout folder with the xml files in that the application runs in the emulator. How could i do it right without deleting the other folder?
> I get the unusable error "Failed to install *.apk on device 'emulator-5556':
> timeout Launch
this issue has nothing to do with your layout design.
this is a adb issue.
try executing this command from any terminal or console window
prior to installing your application
path/to/your/android-sdk/platform-tools/.adb kill-server
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
You can try this new layout xml file. And, you should notice that, this file name "layout.xml" and put it in layout folder. But, I don't think this is a problem, because when you don't do this will see error when compile
Hi iam working on android getting the following problem for my login but i didn't got my mistake... The error notice is the application has been terminated unexpectedly
my code is
package layout.program;
import android.app.Activity;
import android.os.Bundle;
public class Tablelayout extends Activity{
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.tablelayout);
}
}
tablelayout.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow android:id="#+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:layout_height="wrap_content" android:text="TextView" android:id="#+id/textView1" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="wrap_content"></TextView>
<EditText android:id="#+id/editText1" android:layout_height="wrap_content" android:layout_width="fill_parent">
<requestFocus></requestFocus>
</EditText>
</TableRow>
</TableLayout>
Try Cleaning your Project..
By Selecting the Project and then go to top project option and then select clean.
and then select OK..
Sometimes Changes are not made in R.java...Thats y this error comes
Your code is working fine at my end..please look in your code if there is anything which is causing the exception..Try to debug with debugger....
There's nothing wrong with your code or xml, so it has to be an error in your manifest.
As this application is just a stub, why not do this:
Create a new Android project, call it anything you like.
Call the activity 'TableLayoutActivity'
Put your tablelayout.xml into the layout folder.
Change the automatically generated code in TablelayoutActivity.java to set the content view from setContentView(R.layout.main) to setContentView(R.layout.tablelayout)
This should work, then have a look at the manifest in the new project, to see where you went wrong in your original project.
change the class name and try again,also check if the activity name mentioned in the android manifest is correct.