Unable to find explicit activity class {}; have you declared this activity in your AndroidManifest.xml

后端 未结 2 793
死守一世寂寞
死守一世寂寞 2021-01-18 19:49

I\'m trying unzip some files in background, so I use IntentService like in google\'s tutorial. My service class declared in AndroidManifest like this:



        
2条回答
  •  灰色年华
    2021-01-18 20:38

    You are starting a service as an activity

    Change

    Intent mServiceIntent = new Intent(context, UnZipService.class);
    mServiceIntent.setData(Uri.parse(savedFilePath));
    startActivity(mServiceIntent);
    

    to

    Intent mServiceIntent = new Intent(context, UnZipService.class);
    mServiceIntent.setData(Uri.parse(savedFilePath));
    startService(mServiceIntent); // Only this line is changed
    

提交回复
热议问题