Hello,
I am trying to create Authenticator, but when I try to create new account I get java.lang.ClassNotFoundException error
I tried to lookup for solutions, but I didn´t find anything that helped
[monodroid-gc] GREF GC Threshold: 1800 [AndroidRuntime] Shutting down VM [AndroidRuntime] FATAL EXCEPTION: main [AndroidRuntime] java.lang.RuntimeException: Unable to instantiate service Apptest.Apptest.AuthenticatorService: java.lang.ClassNotFoundException: Apptest.Apptest.AuthenticatorService in loader dalvik.system.PathClassLoader[/data/app/Apptest.Apptest-1.apk] [AndroidRuntime] at android.app.ActivityThread.handleCreateService(ActivityThread.java:2020) [AndroidRuntime] at android.app.ActivityThread.access$2500(ActivityThread.java:122) [AndroidRuntime] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1056) [AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:99) [AndroidRuntime] at android.os.Looper.loop(Looper.java:132) [AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:4025) [AndroidRuntime] at java.lang.reflect.Method.invokeNative(Native Method) [AndroidRuntime] at java.lang.reflect.Method.invoke(Method.java:491) [AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) [AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) [AndroidRuntime] at dalvik.system.NativeStart.main(Native Method) [AndroidRuntime] Caused by: java.lang.ClassNotFoundException: Apptest.Apptest.AuthenticatorService in loader dalvik.system.PathClassLoader[/data/app/Apptest.Apptest-1.apk] [AndroidRuntime] at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251) [AndroidRuntime] at java.lang.ClassLoader.loadClass(ClassLoader.java:540) [AndroidRuntime] at java.lang.ClassLoader.loadClass(ClassLoader.java:500) [AndroidRuntime] at android.app.ActivityThread.handleCreateService(ActivityThread.java:2017) [AndroidRuntime] ... 10 more
my Manifest:
<?xml version="1.0" encoding="UTF-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="Apptest.Apptest"> <uses-sdk android:minSdkVersion="12" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.READ_SYNC_STATS" /> <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> <uses-permission android:name="android.permission.ACCOUNT_MANAGER" /> <application android:label="@string/app_name"> <service android:name=".AuthenticatorService" android:exported="false"> <intent-filter> <action android:name="android.accounts.AccountAuthenticator" /> </intent-filter> <meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator" /> </service> <activity android:name=".AuthenticatorActivity" android:label="@string/ui_activity_title" android:theme="@android:style/Theme.Dialog" android:excludeFromRecents="true"></activity> <activity android:name=".MainActivity" android:label="@string/ui_activity_title" android:theme="@android:style/Theme.Dialog" android:excludeFromRecents="true"></activity> </application> </manifest>
and my class:
`namespace Apptest
{
class AuthenticatorService : Service
{
private static string TAG = "AuthenticatorService";
private Authenticator mAuthenticator;
public override void OnCreate() { mAuthenticator = new Authenticator(this); } public override void OnDestroy() { } public override IBinder OnBind(Intent intent) { return mAuthenticator.IBinder; } }
}`
Thanks in advance
Posts
I'm not sure if putting your service in the app manifest is the best way to go. You can simply put an attribute in your service class.
Well...I´m begginer with this... not that it change anything.. the project could help identify the problem...
https://mega.co.nz/#!WEkx1CiI!R6bK9ndATwOUVQhU_9yKMBiD-TAtQaVO9WJFvr0h20o