0

가능한 중복 :
Android RuntimeException: Unable to instantiate the serviceIntentService의 RuntimeException

문제점 : IntentServiceRuntimeException 생성 시작.

나는 우둔합니다. 더 많은 정보가 필요하면 그냥 물어보십시오. (그것이 ContentProvider에서 호출되는 것)

D/dalvikvm(6839): newInstance failed: no <init>() 
D/AndroidRuntime(6839): Shutting down VM 
W/dalvikvm(6839): threadid=1: thread exiting with uncaught exception (group=0x40015560) 
E/AndroidRuntime(6839): FATAL EXCEPTION: main 
E/AndroidRuntime(6839): java.lang.RuntimeException: Unable to instantiate service org.xyz.android.service.MyService: java.lang.InstantiationException: org.xyz.android.service.MyService 
E/AndroidRuntime(6839): at android.app.ActivityThread.handleCreateService(ActivityThread.java:1929) 
E/AndroidRuntime(6839): at android.app.ActivityThread.access$2500(ActivityThread.java:117) 
E/AndroidRuntime(6839): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985) 
E/AndroidRuntime(6839): at android.os.Handler.dispatchMessage(Handler.java:99) 
E/AndroidRuntime(6839): at android.os.Looper.loop(Looper.java:130) 
E/AndroidRuntime(6839): at android.app.ActivityThread.main(ActivityThread.java:3683) 
E/AndroidRuntime(6839): at java.lang.reflect.Method.invokeNative(Native Method) 
E/AndroidRuntime(6839): at java.lang.reflect.Method.invoke(Method.java:507) 
E/AndroidRuntime(6839): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
E/AndroidRuntime(6839): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
E/AndroidRuntime(6839): at dalvik.system.NativeStart.main(Native Method) 
E/AndroidRuntime(6839): Caused by: java.lang.InstantiationException: org.xyz.android.service.MyService 
E/AndroidRuntime(6839): at java.lang.Class.newInstanceImpl(Native Method) 
E/AndroidRuntime(6839): at java.lang.Class.newInstance(Class.java:1409) 
E/AndroidRuntime(6839): at android.app.ActivityThread.handleCreateService(ActivityThread.java:1926) 
E/AndroidRuntime(6839): ... 10 more 

이 코드는 서비스를 호출 : : 로그인합니다. 두 가지 방법이 있습니다 (

Intent i = new Intent(
     getContext(), 
     MyService.class); 
    i.putStringArrayListExtra(EXTRA_MISSING, missingMonths); 
    i.putExtra(EXTRA_URI, uri); 
    i.putExtra(EXTRA_START, startTime); 
    i.putExtra(EXTRA_END, endTime); 
    getContext().startService(i); 

을 그리고 이것은 IntentService 관련 코드 블록 인 AsyncTask를 자체 외에도, 물론) :

public MyService(String name) { 
    super("MyService"); 
} 

@Override 
protected void onHandleIntent(Intent intent) { 
     // ... do stuff 
     new DownloaderTask().execute(missingMonths); 
} 
+0

매니페스트에 설명하셨습니까? – logcat

+0

@rds 동의합니다. :-) – davidcesarino

답변

7

인자가없는 public 생성자가 누락 된 것으로 보입니다. 현재 생성자에서 String name을 삭제하십시오 (어쨌든 사용하지 않으므로). 그러면 잘 수행해야합니다.

+0

고마워, 나는 그걸 완전히 놓쳤다. – davidcesarino

+1

이유를 지정할 수 있습니까? 거기에있어 기본 설정으로 – Bora

관련 문제