Answer the question
In order to leave comments, you need to log in
In Android Studio, when using the getApplicationContext() method in getInstance() in a Fragment in onCreateView() , the app crashes. How to fix?
Below is part of the Fragment code. Absolutely, the error is in the following line:
mDbxAcctMgr = DbxAccountManager.getInstance(activity.getApplicationContext(), APP_KEY, APP_SECRET);
public class MusicFragment extends Fragment {
Activity activity;
private DbxAccountManager mDbxAcctMgr;
private static final String APP_KEY = "u**************";
private static final String APP_SECRET = "q**************";
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof Activity){
activity=(Activity) context;
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.activity_music, container, false);
mDbxAcctMgr = DbxAccountManager.getInstance(activity.getApplicationContext(), APP_KEY, APP_SECRET);
return view;
}
}
Process: com.mopchik.mopchik, PID: 26357
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList] couldn't find "libDropboxSync.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1562)
at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:364)
at com.dropbox.sync.android.NativeLib.<init>(NativeLib.java:33)
at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:11)
at com.dropbox.sync.android.NativeLib.getInstance(NativeLib.java:26)
at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:109)
at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:89)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:112)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:99)
at com.mopchik.mopchik.MusicFragment.onCreateView(MusicFragment.java:61)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2346)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1428)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1759)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1827)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2596)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2383)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2338)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2245)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:703)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6195)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Answer the question
In order to leave comments, you need to log in
The log directly says that the .so library from dropbox was not found. The text from the title of the question has nothing to do with it. I connected the library incorrectly, most likely. Recheck. If everything is correct, you can try using ReLinker.
Unzip the apk and see if the mentioned .so is there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question