问题描述
我目前有4个不同的按钮。它们中的3个导致相同的活动,但用不同的数据填充ArrayList。不同数据集之间的唯一区别是大小。
I currently have 4 different buttons. 3 of them lead to the same activity, but populate an ArrayList with different data. The only difference between the different sets of data is the size.
每次我使用工作按钮 selectCountryAndStateButton
时,一切正常。但是,当我使用 getAllFacilitiesButton
时,应用程序返回到上一个活动,并且在LogCat中得到以下内容
Everytime I use the working button selectCountryAndStateButton
everything works fine. However when I use the getAllFacilitiesButton
the application returns to the previous activity and I get the following in LogCat
02-08 11:56:26.649 22325-22325/? W/System: ClassLoader referenced unknown path: /data/app/com.company.app-1/lib/x86
02-08 11:56:26.668 22325-22325/? I/GMPM: App measurement is starting up, version: 8487
02-08 11:56:26.668 22325-22325/? I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
02-08 11:56:26.791 22325-22336/com.company.app I/art: Background partial concurrent mark sweep GC freed 418(17KB) AllocSpace objects, 0(0B) LOS objects, 40% free, 4MB/7MB, paused 9.593ms total 21.620ms
02-08 11:56:27.097 22325-22359/com.company.app D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
02-08 11:56:27.177 22325-22359/com.company.app I/OpenGLRenderer: Initialized EGL, version 1.4
02-08 11:56:27.187 22325-22359/com.company.app W/EGL_emulation: eglSurfaceAttrib not implemented
02-08 11:56:27.187 22325-22359/com.company.app W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad7e0960, error=EGL_SUCCESS
在发生错误之前,我收到了以下消息。
Prior to the error, I received the following.
02-08 11:38:41.064 14907-14907/? E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
但是我通过添加 google_app_id.xml $ c $来更正错误c>我的资源。
However I corrected the error by adding google_app_id.xml
to my resources.
当相同的精确代码处理的数据集要小得多时,为什么会出现类加载器未知的引用问题?
Why am I getting a class loader unknown reference problem when the same exact code works with a set of data that is much smaller?
编辑:2/8/2016 1:25 pm [中央]
2/8/2016 1:25pm [central]
发现我的邮件已被过滤。我收到以下错误:
Found out my messages were filtered. I'm getting the following error:
E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 526172)
这意味着我的644个对象列表太大而无法传递到下一个对象活动。将会给出解决方案
Which means my List of 644 objects is too big to pass to the next activity. Will answer with solution
-----下面是我的代码-----
-----Below is my code-----
工作按钮(facilities.size()< 100)
Working Button (facilities.size() < 100 )
selectCountryAndStateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ServiceConnector sc = getServiceConnector();
sc.execute(APICallEnum.SEARCH_BY_COUNTRY, countrySelected, stateSelected);
try {
String data = sc.get();
List<Facility> facilities = JSONParser.getFromJson(data);
//Open list activity of facilities
openListActivity(facilities);
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
按钮不起作用(facilities.size()= 644)
Button does not work (facilities.size() = 644)
getAllFacilitiesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("Search", "get all");
ServiceConnector sc = getServiceConnector();
sc.execute(APICallEnum.GET_ALL_FACILITIES);
try {
String data = sc.get();
List<Facility> facilities = JSONParser.getFromJson(data);
openListActivity(facilities);
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
打开下一个活动代码
private void openListActivity(List<Factility> f) {
Intent intent = new Intent(FindLocation.this, ListingActivity.class);
intent.putExtra("facilities", new FacilityList(f));
startActivity(intent);
}
推荐答案
问题是由于尝试通过意图传递大量的设施。
The issue was caused by trying to pass a large list of facilities through the intent.
我通过执行在新活动中检索数据的get来解决了这个问题,而是传递了该get所需的信息。
I solved this by performing the get that retrieved the data in the new activity, and instead passing the information needed for the get.
这篇关于转到下一个活动时,ClassLoader引用了未知路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!