Reputation: 2032
The following lines within a Fragment
are throwing an exception for which I am unable to find the root cause.
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_player_pane, container, false);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
// set width height
params.height = (getArguments().getInt(HEIGHT));
params.width = (getArguments().getInt(WIDTH));
fragmentHeight = (getArguments().getInt(HEIGHT));
fragmentWidth = (getArguments().getInt(WIDTH));
// substitute parameters for left,top, right, bottom, (All 4 not necessary)
params.setMargins((getArguments().getInt(LEFT_MARGIN)),
(getArguments().getInt(TOP_MARGIN)),
(getArguments().getInt(RIGHT_MARGIN)),
(getArguments().getInt(BOTTOM_MARGIN)));
youTubePlayerNecessary = getArguments().getBoolean(REQUIRE_YOUTUBE);
rotate = getArguments().getBoolean(REQUIRE_ROTATION);
muteAudio = getArguments().getBoolean(MUTE_AUDIO);
rootView.setLayoutParams(params);
return rootView;
}
Exception:
11-02 11:36:04.966 3440-3452/com.blynq.app.multipaneplayer E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'close' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:127)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.startChromiumLocked(WebViewChromiumFactoryProvider.java:16107)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.ensureChromiumStartedLocked(WebViewChromiumFactoryProvider.java:333)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.startYourEngines(WebViewChromiumFactoryProvider.java:427)
at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:162)
at android.webkit.WebView.<init>(WebView.java:554)
at android.webkit.WebView.<init>(WebView.java:489)
at android.webkit.WebView.<init>(WebView.java:472)
at android.webkit.WebView.<init>(WebView.java:459)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at com.blynq.app.fragments.PlayerPane.onCreateView(PlayerPane.java:181)
at android.app.Fragment.performCreateView(Fragment.java:2053)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:894)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.app.BackStackRecord.run(BackStackRecord.java:834)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1454)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:447)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
I am currently running app in debug mode to check all possible memory leaks.
if (BuildConfig.DEBUG) {
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath()
.build());
}
All tags in manifest file are properly closed too. I am unable to figure out which resource was left open without being handled. How do I resolve this ?
P.S. I have referred to thread before asking the question, which is a very generic question offering no new necessary insight for me. This question is very specific to the details mentioned above, here I am seeking help to find which resource is causing the leak..
Upvotes: 2
Views: 801
Reputation: 21
Somebody raised an issue for this here: https://code.google.com/p/android/issues/detail?id=226751
I've been having the same issue, and it looks like it's a bug in API < 25. Try your program in an emulator with API 25 and see if it works. If it works there, then it is most likely the same problem and you are out of luck until is able to fix the issue.
Upvotes: 2
Reputation: 371
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog()
.penaltyDeath().build());
For more Information Follow this Url Error Solve Url
Upvotes: 0