• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Transfering from 3.1 to 2.1 problems

Lukazon

Lurker
Hello there this is my first post on this forum and I hope to get an reply to it. So, I just started out programming Android Applications really but I know basic Java so it wasn't very hard to comprehend the basics of Android. Anyway, at first I used an 3.1 emulator(which worked perfectly fine) to test my program which worked fine. I reliased the real life phone I was going to test my program on runned on Android 2.1 so I created a new emulator for that and tried testing my program. I changed all the SDK versions in the Manifest file and others where it was necessary, but when my .apk file is all installed and done I try to run it and it crashes right away.

Code:
[LEFT]package lucas.msg.sender;[/LEFT]
 
[LEFT]import android.app.Activity;
import android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;[/LEFT]
 
[LEFT]public class MessageSender21 extends Activity {
Button ok;
Button cancel;
EditText et;
TextView tv;
String msg;[/LEFT]
 
[LEFT]String nbr = "0739492749";
SmsManager sms = SmsManager.getDefault();[/LEFT]
 
[LEFT]@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);[/LEFT]
 
[LEFT]ok = (Button)findViewById(R.id.ok);
cancel = (Button)findViewById(R.id.exit);
et = (EditText)findViewById(R.id.entry);
tv = (TextView)findViewById(R.id.result);[/LEFT]
 
[LEFT]ok.setOnClickListener(buttonListener);
cancel.setOnClickListener(buttonListener);
}[/LEFT]
 
[LEFT]private OnClickListener buttonListener = new OnClickListener() {
public void onClick(View v) {
if(v.getId() == R.id.ok){
msg = et.getText().toString();
try{
sms.sendTextMessage(nbr, null, msg, null, null);
}catch(Exception e){
tv.setText(e.toString());
} 
}else
finish();
}
};[/LEFT]
}

Thats my code for this program, possibly not looking very good after the copy-pasta but anyway. If you need any .xml files or anything I'll post them.​

Thankful for help!​

EDIT: The point of the program is basically to send an SMS with a text(the number is currently hardcoded). I'll go ahead and post main.xml:​

Code:
[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<?[/COLOR][/SIZE]
[LEFT][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]xml[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]version[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"1.0"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]encoding[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"utf-8"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]?>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]RelativeLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]xmlns:android[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff][URL]http://schemas.android.com/apk/res/android[/URL][/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"fill_parent"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/LEFT]
 
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"fill_parent"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/COLOR][/SIZE][/COLOR][/SIZE]

[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]

 
[LEFT][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]TextView[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/label"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"fill_parent"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/LEFT]
 
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I]

[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Message:"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE] [/LEFT]
[/LEFT]

 
[LEFT][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]TextView[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/result"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"fill_parent"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/LEFT]
 
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I]

[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_below[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/entry"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[/LEFT]

 
[LEFT][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]EditText[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/entry"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/LEFT]
 
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"fill_parent"[/COLOR][/SIZE][/COLOR][/SIZE][/I]

[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:background[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"#000"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_below[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@id/label"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[/LEFT]

 
[LEFT][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]Button[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/ok"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/LEFT]
 
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I]

[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_below[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@id/entry" [/COLOR][/SIZE][/COLOR][/SIZE][/I]
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_alignParentRight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"true"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_marginLeft[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"10dip"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Send"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[/LEFT]

 
[LEFT][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]Button[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/exit"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/LEFT]
 
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I]

[SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_toLeftOf[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@id/ok"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_alignTop[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@id/ok"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/LEFT]
[/LEFT]

 
[LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Exit"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/></[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]RelativeLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]

Is there maybe something in this code that was presented after 2.1 that I need to remove?
 
Welcome to AF!

What is the error message/stack trace when it crashes?

The stack trace should be the first place you look when your app crashes :)
 
Back
Top Bottom