Note that there are some explanatory texts on larger screens.

plurals
  1. POApplication not working after importing library
    primarykey
    data
    text
    <p>Hi i created main application which has a button "savenotes" which on click should open the "Notepad" sample given in Eclipse IDE . Here is what i did :</p> <ol> <li>imported NotesList project in my workspace</li> <li>right clicked and marked it as a library</li> <li>right clicked my main project and added the reference to library 4.In project.properties added manifestmerger.enabled=true</li> </ol> <p>Now strangely what is happening is that when i mention the "savenotes" activity in manifest which i should declare my logcat stops displaying the log and gives error device disconnected. When i remove this activity it starts displaying the log . However in both cases every time i click on my savenotes button the application force closes . Am not sure what am i doing wrong and what i missed .</p> <p><strong>Mainmenu.java</strong></p> <pre><code>package helog.diwesh.NugaBest; import hellog.diwesh.NugaBest.R; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.media.AudioManager; import android.media.SoundPool; import android.os.Bundle; import android.os.Environment; import android.os.Vibrator; import android.util.Log; import android.view.View; import android.view.Window; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.ScaleAnimation; import android.widget.Button; import android.widget.Toast; import com.example.android.notepad.NotesList; public class NUGA_MainMenuActivity extends Activity { SoundPool mpool; int mlogon; Button mBtn1; Button mBtn2; Button mBtn3; Button mBtn4; Button mBtn5; Button mHistoryButton; Animation anim = null; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.mainmenu); mHistoryButton=(Button) findViewById(R.id.takeashot); mBtn1 = (Button) findViewById(R.id.BtnDisplay); mBtn2 = (Button) findViewById(R.id.BtnSlave); mHistoryButton.setOnClickListener(mClickListener); mBtn3=(Button) findViewById(R.id.takehelp); mBtn4=(Button) findViewById(R.id.aboutus); mBtn5=(Button) findViewById(R.id.savenotes); mBtn1.setOnClickListener(mClickListener); mBtn2.setOnClickListener(mClickListener); mBtn3.setOnClickListener(mClickListener); mBtn4.setOnClickListener(mClickListener); mBtn5.setOnClickListener(mClickListener); mpool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0); mlogon = mpool.load(this, R.raw.logon, 1); anim = new AlphaAnimation(0, 1); anim.setDuration(1500); mBtn1.startAnimation(anim); mBtn2.startAnimation(anim); mBtn3.startAnimation(anim); mBtn4.startAnimation(anim); mBtn5.startAnimation(anim); mpool.play(mlogon, 1, 1, 0, 0, 1); } Button.OnClickListener mClickListener = new View.OnClickListener() { Animation anim = null; @Override public void onClick(View v) { Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vibe.vibrate(60); switch (v.getId()) { case R.id.BtnDisplay: mpool.play(mlogon, 1, 1, 0, 0, 1); anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(100); mBtn1.startAnimation(anim); Intent intent = new Intent(NUGA_MainMenuActivity.this, FileSiganlDisplay.class); startActivity(intent); //overridePendingTransition(R.anim.zoom_enter,R.anim.zoom_exit); overridePendingTransition(R.anim.fade, R.anim.hold); break; case R.id.BtnSlave: mpool.play(mlogon, 1, 1, 0, 0, 1); anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(100); mBtn2.startAnimation(anim); Intent intent1 = new Intent(NUGA_MainMenuActivity.this, BTSmartSlavemodule.class); startActivity(intent1); //overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit); overridePendingTransition(R.anim.fade, R.anim.hold); break ; case R.id.takeashot: //snapFunction(); Intent intent2=new Intent(NUGA_MainMenuActivity.this,ImagesActivity.class); startActivity(intent2); break; case R.id.takehelp : mpool.play(mlogon, 1, 1, 0, 0, 1); anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(100); mBtn3.startAnimation(anim); Intent intent3=new Intent(NUGA_MainMenuActivity.this,HelpActivity.class); startActivity(intent3); overridePendingTransition(R.anim.fade, R.anim.hold); break; case R.id.aboutus: mpool.play(mlogon, 1, 1, 0, 0, 1); anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(100); mBtn4.startAnimation(anim); Intent intent4=new Intent(NUGA_MainMenuActivity.this,AboutDevice.class); startActivity(intent4); overridePendingTransition(R.anim.fade, R.anim.hold); break; case R.id.savenotes: mpool.play(mlogon, 1, 1, 0, 0, 1); anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(100); mBtn4.startAnimation(anim); Intent intent5=new Intent(NUGA_MainMenuActivity.this,NotesList.class); startActivity(intent5); overridePendingTransition(R.anim.fade, R.anim.hold); break; default: break; } } }; public void snapFunction() { Date currentTime = new Date(); final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss"); // Give it to me in GMT time. sdf.setTimeZone(TimeZone.getTimeZone("GMT")); //System.out.println("GMT time: " + sdf.format(currentTime)); String ss=sdf.format(currentTime); Log.v("current time", ss); View mContent=findViewById(R.id.screenLayout); mContent.setDrawingCacheEnabled(true); Bitmap bitmap = mContent.getDrawingCache(); File sdCardDirectory = Environment.getExternalStorageDirectory(); File image = new File(sdCardDirectory, ss+".jpg"); name=ss; // File file = new File("/sdcard/"+String.valueOf(currentId)+".png"); { if(!image.exists()) { try { image.createNewFile(); FileOutputStream ostream = new FileOutputStream(image); bitmap.compress(CompressFormat.PNG, 10, ostream); ostream.close(); mContent.invalidate(); DB.insert(ss); Cursor cursor=DB.retrieveFav(); if(cursor!=null) if(cursor.moveToFirst()) new Toast(NUGA_MainMenuActivity.this).makeText(NUGA_MainMenuActivity.this, "DB contains:"+cursor.getCount()+"images", Toast.LENGTH_LONG).show(); cursor.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } static String name=""; </code></pre> <h2> }</h2> <p><strong>My Manifest</strong> </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="hellog.diwesh.NugaBest" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="11" /&gt; &lt;uses-permission android:name="android.permission.VIBRATE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /&gt; &lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;application android:name="helog.diwesh.NugaBest.MyApplication" android:debuggable="true" android:icon="@drawable/nuga" android:label="@string/app_name" &gt; &lt;activity android:name="helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro" android:configChanges="orientation|keyboardHidden" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; // 4. Layout Management &lt;activity android:name="helog.diwesh.NugaBest.FileSiganlDisplay" android:label="FileSiganlDisplay" /&gt; &lt;activity android:name="helog.diwesh.NugaBest.NUGA_WebJoinActivity" android:label="NUGA_WebJoinActivity" android:windowSoftInputMode="stateHidden" /&gt; &lt;activity android:name="helog.diwesh.NugaBest.NUGA_MainMenuActivity" android:label="NUGA_MainMenuActivity" /&gt; &lt;activity android:name="helog.diwesh.NugaBest.BTSmartSlavemodule" android:configChanges="orientation|keyboardHidden" android:label="SmartSlavemodule" /&gt; &lt;activity android:name="helog.diwesh.NugaBest.BTDeviceListActivity" android:configChanges="orientation|keyboardHidden" android:label="@string/select_device" android:theme="@android:style/Theme.Dialog" /&gt; &lt;activity android:name="helog.diwesh.NugaBest.SnapActivity" android:label="@string/title_activity_snap" &gt; &lt;/activity&gt; &lt;activity android:name="helog.diwesh.NugaBest.ImagesActivity" android:label="@string/title_activity_images" &gt; &lt;/activity&gt; &lt;activity android:name="helog.diwesh.NugaBest.HelpActivity" android:label="@string/Help" &gt; &lt;/activity&gt; &lt;activity android:name="helog.diwesh.NugaBest.AboutDevice" android:label="@string/aboutus" &gt; &lt;/activity&gt; &lt;activity android:name="helog.diwesh.NugaBest.Savenotes" android:label="@string/savenotes" &gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <h2> </h2> <p>project.properties</p> <pre><code># This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system use, # "ant.properties", and override values to adapt the script to your # project structure. # Project target. target=Google Inc.:Google APIs:18 android.library.reference.1=C:/Users/DPC/Downloads/adt-bundle-windows-x86-20130729/adt-bundle-windows-x86-20130729/sdk/samples/android-18/legacy/NotePad manifestmerger.enabled=true </code></pre> <hr> <p>NotesList manifest</p> <pre><code>&lt;!-- Declare the contents of this Android application. The namespace attribute brings in the Android platform namespace, and the package supplies a unique name for the application. When writing your own application, the package name must be changed from "com.example.*" to come from a domain that you own or have control over. --&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.notepad" &gt; &lt;uses-sdk android:minSdkVersion="11" /&gt; &lt;application android:icon="@drawable/app_notes" android:label="@string/app_name" &gt; &lt;provider android:name="NotePadProvider" android:authorities="com.google.provider.NotePad" android:exported="false"&gt; &lt;grant-uri-permission android:pathPattern=".*" /&gt; &lt;/provider&gt; &lt;activity android:name="NotesList" android:label="@string/title_notes_list"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;action android:name="android.intent.action.EDIT" /&gt; &lt;action android:name="android.intent.action.PICK" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.GET_CONTENT" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="NoteEditor" android:theme="@android:style/Theme.Holo.Light" android:screenOrientation="sensor" android:configChanges="keyboardHidden|orientation" &gt; &lt;!-- This filter says that we can view or edit the data of a single note --&gt; &lt;intent-filter android:label="@string/resolve_edit"&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;action android:name="android.intent.action.EDIT" /&gt; &lt;action android:name="com.android.notepad.action.EDIT_NOTE" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt; &lt;/intent-filter&gt; &lt;!-- This filter says that we can create a new note inside of a directory of notes. The INSERT action creates an empty note; the PASTE action initializes a new note from the current contents of the clipboard. --&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.INSERT" /&gt; &lt;action android:name="android.intent.action.PASTE" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="TitleEditor" android:label="@string/title_edit_title" android:icon="@drawable/ic_menu_edit" android:theme="@android:style/Theme.Holo.Dialog" android:windowSoftInputMode="stateVisible"&gt; &lt;!-- This activity implements an alternative action that can be performed on notes: editing their title. It can be used as a default operation if the user invokes this action, and is available as an alternative action for any note data. --&gt; &lt;intent-filter android:label="@string/resolve_title"&gt; &lt;!-- This is the action we perform. It is a custom action we define for our application, not a generic VIEW or EDIT action since we are not a general note viewer/editor. --&gt; &lt;action android:name="com.android.notepad.action.EDIT_TITLE" /&gt; &lt;!-- DEFAULT: execute if being directly invoked. --&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;!-- ALTERNATIVE: show as an alternative action when the user is working with this type of data. --&gt; &lt;category android:name="android.intent.category.ALTERNATIVE" /&gt; &lt;!-- SELECTED_ALTERNATIVE: show as an alternative action the user can perform when selecting this type of data. --&gt; &lt;category android:name="android.intent.category.SELECTED_ALTERNATIVE" /&gt; &lt;!-- This is the data type we operate on. --&gt; &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="NotesLiveFolder" android:label="@string/live_folder_name" android:icon="@drawable/live_folder_notes"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.CREATE_LIVE_FOLDER" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <hr> <p><strong>Logcat details when savenotes is not added in manifest</strong></p> <pre><code>09-22 22:07:36.157: D/dalvikvm(799): GC_FOR_ALLOC freed 67K, 7% free 2543K/2728K, paused 87ms, total 88ms 09-22 22:07:36.237: I/dalvikvm-heap(799): Grow heap (frag case) to 4.939MB for 2457616-byte allocation 09-22 22:07:36.367: D/dalvikvm(799): GC_FOR_ALLOC freed &lt;1K, 4% free 4943K/5132K, paused 127ms, total 127ms 09-22 22:07:36.887: W/SoundPool(799): sample 1 not READY 09-22 22:07:37.197: D/gralloc_goldfish(799): Emulator without GPU emulation detected. 09-22 22:07:39.146: E/AudioTrack(799): Could not get audio output for stream type 3 09-22 22:07:39.146: E/SoundPool(799): Error creating AudioTrack 09-22 22:07:39.256: D/dalvikvm(799): GC_FOR_ALLOC freed 28K, 3% free 5673K/5828K, paused 21ms, total 23ms 09-22 22:07:39.336: D/dalvikvm(799): GC_FOR_ALLOC freed 22K, 3% free 6090K/6236K, paused 21ms, total 26ms 09-22 22:07:39.426: I/Choreographer(799): Skipped 72 frames! The application may be doing too much work on its main thread. 09-22 22:07:39.656: I/Choreographer(799): Skipped 54 frames! The application may be doing too much work on its main thread. 09-22 22:07:39.826: I/Choreographer(799): Skipped 33 frames! The application may be doing too much work on its main thread. 09-22 22:07:40.116: I/Choreographer(799): Skipped 56 frames! The application may be doing too much work on its main thread. 09-22 22:07:43.946: E/dalvikvm(799): Could not find class 'com.example.android.notepad.NotesList', referenced from method helog.diwesh.NugaBest.NUGA_MainMenuActivity$1.onClick 09-22 22:07:43.976: W/dalvikvm(799): VFY: unable to resolve const-class 655 (Lcom/example/android/notepad/NotesList;) in Lhelog/diwesh/NugaBest/NUGA_MainMenuActivity$1; 09-22 22:07:43.976: D/dalvikvm(799): VFY: replacing opcode 0x1c at 0x01fe 09-22 22:07:44.186: D/dalvikvm(799): GC_FOR_ALLOC freed 85K, 3% free 6817K/7020K, paused 115ms, total 161ms 09-22 22:07:44.236: I/dalvikvm-heap(799): Grow heap (frag case) to 9.113MB for 2457616-byte allocation 09-22 22:07:44.426: D/dalvikvm(799): GC_FOR_ALLOC freed 2K, 3% free 9215K/9424K, paused 195ms, total 195ms 09-22 22:07:44.726: W/SoundPool(799): sample 1 not READY 09-22 22:07:44.946: I/Choreographer(799): Skipped 43 frames! The application may be doing too much work on its main thread. 09-22 22:07:45.426: I/Choreographer(799): Skipped 49 frames! The application may be doing too much work on its main thread. 09-22 22:07:51.186: E/AudioTrack(799): Could not get audio output for stream type 3 09-22 22:07:51.186: E/SoundPool(799): Error creating AudioTrack 09-22 22:07:51.546: D/dalvikvm(799): GC_FOR_ALLOC freed 46K, 2% free 9476K/9640K, paused 39ms, total 68ms 09-22 22:07:51.596: I/dalvikvm-heap(799): Grow heap (frag case) to 12.317MB for 3094560-byte allocation 09-22 22:07:51.756: D/dalvikvm(799): GC_FOR_ALLOC freed 4220K, 35% free 8277K/12664K, paused 154ms, total 154ms 09-22 22:07:51.977: I/Choreographer(799): Skipped 173 frames! The application may be doing too much work on its main thread. 09-22 22:07:52.106: I/Choreographer(799): Skipped 30 frames! The application may be doing too much work on its main thread. 09-22 22:07:52.476: I/Choreographer(799): Skipped 82 frames! The application may be doing too much work on its main thread. 09-22 22:07:59.586: E/AudioTrack(799): Could not get audio output for stream type 3 09-22 22:07:59.586: E/SoundPool(799): Error creating AudioTrack 09-22 22:07:59.586: D/AndroidRuntime(799): Shutting down VM 09-22 22:07:59.586: W/dalvikvm(799): threadid=1: thread exiting with uncaught exception (group=0x41465700) 09-22 22:07:59.626: E/AndroidRuntime(799): FATAL EXCEPTION: main 09-22 22:07:59.626: E/AndroidRuntime(799): java.lang.NoClassDefFoundError: com.example.android.notepad.NotesList 09-22 22:07:59.626: E/AndroidRuntime(799): at helog.diwesh.NugaBest.NUGA_MainMenuActivity$1.onClick(NUGA_MainMenuActivity.java:152) 09-22 22:07:59.626: E/AndroidRuntime(799): at android.view.View.performClick(View.java:4240) 09-22 22:07:59.626: E/AndroidRuntime(799): at android.view.View$PerformClick.run(View.java:17721) 09-22 22:07:59.626: E/AndroidRuntime(799): at android.os.Handler.handleCallback(Handler.java:730) 09-22 22:07:59.626: E/AndroidRuntime(799): at android.os.Handler.dispatchMessage(Handler.java:92) 09-22 22:07:59.626: E/AndroidRuntime(799): at android.os.Looper.loop(Looper.java:137) 09-22 22:07:59.626: E/AndroidRuntime(799): at android.app.ActivityThread.main(ActivityThread.java:5103) 09-22 22:07:59.626: E/AndroidRuntime(799): at java.lang.reflect.Method.invokeNative(Native Method) 09-22 22:07:59.626: E/AndroidRuntime(799): at java.lang.reflect.Method.invoke(Method.java:525) 09-22 22:07:59.626: E/AndroidRuntime(799): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 09-22 22:07:59.626: E/AndroidRuntime(799): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 09-22 22:07:59.626: E/AndroidRuntime(799): at dalvik.system.NativeStart.main(Native Method) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload