Android app crashes right after lanuch with simple java coding -
i'm going make short , precise;
*i'm running ubuntu 14.04+
*running eclipse while connected nexus 4 (android 4.3)
*started programing android application had option program @ android level 5.1 (at start of program asks set).
so launched program @ first , gave error
error: application requires api version 22. device api version 18 (android 4.3)
i read online , changed things around in my
<uses-sdk android:minsdkversion="22" android:targetsdkversion="22" />
to
<uses-sdk android:minsdkversion="18" android:targetsdkversion="18" />
but app lanuches , crashes right away. error produced in logcat
gc_for_alloc freed 495k, 6% free 9168k/9704k, paused 12ms, total 12ms
and thats program stops @ in console
activitymanager: starting: intent { act=android.intent.action.main cat= [android.intent.category.launcher] cmp=self.name.firstandroidprogram/.mainactivity
lastly here code in java
package self.name.firstandroidprogram; import android.app.activity; import android.os.bundle; import android.view.menuitem; import android.widget.linearlayout; import android.widget.textview; public class mainactivity extends activity { linearlayout layout1; textview label1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); layout1 = new linearlayout(this); label1 = new textview(this); layout1.addview(layout1); setcontentview(layout1); } }
have added mainactivity
android manifest
?
<uses-sdk android:minsdkversion="18" android:targetsdkversion="18" /> <application .... > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application>
Comments
Post a Comment