Получаю ответ ввиде json, но не могу понять как его записать в Realm
Feed.java
public class Feed extends Fragment {
private final String TAG = "log_tag";
private Realm realm;
private RecyclerView recyclerView;
private SwipeRefreshLayout swipeRefreshLayout;
private ArrayList<Article> engadgetArticles = new ArrayList<>();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.feed_recycler_view, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
ResponseColumn();
}
});
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
RecyclerViewAdapter recyclerViewAdapter = new RecyclerViewAdapter(engadgetArticles);
recyclerView.setAdapter(recyclerViewAdapter);
ResponseColumn();
return view;
}
private void ResponseColumn() {
Gson gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() {
@Override
public boolean shouldSkipField(FieldAttributes f) {
return f.getDeclaredClass().equals(RealmObject.class);
}
@Override
public boolean shouldSkipClass(Class<?> clazz) {
return false;
}
}).create();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://newsapi.org/v1/articles/")
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
EngadgetAPI engadgetAPI = retrofit.create(EngadgetAPI.class);
Call<EngadgetArticle> call = engadgetAPI.getArticle();
call.enqueue(new Callback<EngadgetArticle>() {
@Override
public void onResponse(Call<EngadgetArticle> call, Response<EngadgetArticle> response) {
EngadgetArticle enArt = response.body();
realm.beginTransaction();
realm.copyToRealmOrUpdate(response.body().getArticles());
realm.commitTransaction();
for (int i = 0; i < enArt.getArticles().size(); i++)
engadgetArticles.add(enArt.getArticles().get(i));
recyclerView.getAdapter().notifyDataSetChanged();
Log.d(TAG, "onResponse: " + response.message());
}
@Override
public void onFailure(Call<EngadgetArticle> call, Throwable t) {
Log.d(TAG, "onFailure: " + t.getMessage());
}
});
swipeRefreshLayout.setRefreshing(false);
}
}
Article.java
public class Article extends RealmObject{
@SerializedName("author")
@Expose
private String author;
@SerializedName("title")
@Expose
private String title;
@SerializedName("description")
@Expose
private String description;
@SerializedName("url")
@Expose
private String url;
@SerializedName("urlToImage")
@Expose
private String urlToImage;
@SerializedName("publishedAt")
@Expose
private String publishedAt;
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUrlToImage() {
return urlToImage;
}
public void setUrlToImage(String urlToImage) {
this.urlToImage = urlToImage;
}
public String getPublishedAt() {
return publishedAt;
}
public void setPublishedAt(String publishedAt) {
this.publishedAt = publishedAt;
}
}
EngadgetArticle.java
public class EngadgetArticle {
@SerializedName("status")
@Expose
private String status;
@SerializedName("source")
@Expose
private String source;
@SerializedName("sortBy")
@Expose
private String sortBy;
@SerializedName("articles")
@Expose
private List<Article> articles;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
public List<Article> getArticles() {
return articles;
}
public void setArticles(List<Article> articles) {
this.articles = articles;
}
}
получаю, вот такой вывод
01/04 01:22:44: Launching app
Cold swapped changes.
$ adb shell am start -n "com.example.nikolai.engadgetnews/com.example.nikolai.engadgetnews.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Connected to process 11216 on device genymotion-custom_phone___6_0_0___api_23___768x1280-192.168.124.102:5555
I/InstantRun: Instant Run Runtime started. Android package is com.example.nikolai.engadgetnews, real application class is null.
I/art: Background partial concurrent mark sweep GC freed 21170(1418KB) AllocSpace objects, 4(68KB) LOS objects, 57% free, 770KB/1794KB, paused 256us total 245.373ms
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
I/art: Background sticky concurrent mark sweep GC freed 45138(1743KB) AllocSpace objects, 0(0B) LOS objects, 34% free, 2MB/4MB, paused 5.907ms total 24.341ms
I/art: Background sticky concurrent mark sweep GC freed 16413(590KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 4MB/4MB, paused 6.144ms total 36.825ms
I/art: Background sticky concurrent mark sweep GC freed 36360(792KB) AllocSpace objects, 32(512KB) LOS objects, 15% free, 5MB/6MB, paused 5.229ms total 33.234ms
W/art: Suspending all threads took: 5.157ms
I/art: Background sticky concurrent mark sweep GC freed 23888(510KB) AllocSpace objects, 18(288KB) LOS objects, 10% free, 5MB/6MB, paused 9.093ms total 28.491ms
I/art: Background partial concurrent mark sweep GC freed 23402(551KB) AllocSpace objects, 43(688KB) LOS objects, 39% free, 5MB/9MB, paused 5.282ms total 67.944ms
I/art: Background sticky concurrent mark sweep GC freed 86247(1784KB) AllocSpace objects, 64(1280KB) LOS objects, 26% free, 7MB/9MB, paused 5.851ms total 49.151ms
I/art: Background sticky concurrent mark sweep GC freed 74873(1546KB) AllocSpace objects, 56(1120KB) LOS objects, 22% free, 7MB/9MB, paused 5.465ms total 49.021ms
W/art: Suspending all threads took: 5.168ms
I/art: Background sticky concurrent mark sweep GC freed 66637(1361KB) AllocSpace objects, 46(920KB) LOS objects, 19% free, 7MB/9MB, paused 10.467ms total 57.024ms
I/art: Background sticky concurrent mark sweep GC freed 62998(1277KB) AllocSpace objects, 43(860KB) LOS objects, 17% free, 7MB/9MB, paused 6.086ms total 47.347ms
I/art: Background sticky concurrent mark sweep GC freed 54481(1107KB) AllocSpace objects, 38(760KB) LOS objects, 17% free, 8MB/9MB, paused 6.681ms total 40.366ms
I/art: Background sticky concurrent mark sweep GC freed 48446(975KB) AllocSpace objects, 32(640KB) LOS objects, 14% free, 8MB/9MB, paused 5.961ms total 39.663ms
I/art: Background sticky concurrent mark sweep GC freed 40954(832KB) AllocSpace objects, 29(580KB) LOS objects, 9% free, 8MB/9MB, paused 7.666ms total 99.999ms
I/art: Background partial concurrent mark sweep GC freed 53479(1074KB) AllocSpace objects, 51(1084KB) LOS objects, 39% free, 8MB/14MB, paused 5.363ms total 75.717ms
I/art: Background sticky concurrent mark sweep GC freed 158139(3MB) AllocSpace objects, 99(2MB) LOS objects, 33% free, 9MB/14MB, paused 6.978ms total 66.376ms
I/art: Background sticky concurrent mark sweep GC freed 138230(2MB) AllocSpace objects, 88(2MB) LOS objects, 29% free, 9MB/14MB, paused 6.391ms total 64.664ms
I/art: Background sticky concurrent mark sweep GC freed 127594(2MB) AllocSpace objects, 76(1824KB) LOS objects, 25% free, 10MB/14MB, paused 7.534ms total 72.611ms
I/art: Background sticky concurrent mark sweep GC freed 111412(2MB) AllocSpace objects, 66(1584KB) LOS objects, 21% free, 11MB/14MB, paused 7.355ms total 75.189ms
I/art: Background sticky concurrent mark sweep GC freed 99483(1944KB) AllocSpace objects, 58(1392KB) LOS objects, 19% free, 11MB/14MB, paused 7.940ms total 73.322ms
I/art: Background sticky concurrent mark sweep GC freed 82995(1607KB) AllocSpace objects, 45(1148KB) LOS objects, 17% free, 11MB/14MB, paused 9.754ms total 63.038ms
I/art: Background sticky concurrent mark sweep GC freed 73699(1435KB) AllocSpace objects, 42(1176KB) LOS objects, 14% free, 12MB/14MB, paused 7.735ms total 56.313ms
I/art: Background sticky concurrent mark sweep GC freed 67971(1308KB) AllocSpace objects, 36(1008KB) LOS objects, 12% free, 12MB/14MB, paused 7.809ms total 59.834ms
I/art: Background sticky concurrent mark sweep GC freed 56670(1100KB) AllocSpace objects, 32(896KB) LOS objects, 9% free, 12MB/14MB, paused 7.113ms total 63.128ms
I/art: Background sticky concurrent mark sweep GC freed 47728(928KB) AllocSpace objects, 27(756KB) LOS objects, 8% free, 12MB/14MB, paused 9.103ms total 76.330ms
I/art: Background partial concurrent mark sweep GC freed 75045(1429KB) AllocSpace objects, 56(1508KB) LOS objects, 39% free, 12MB/20MB, paused 6.058ms total 106.798ms
I/art: Background sticky concurrent mark sweep GC freed 242774(4MB) AllocSpace objects, 128(3MB) LOS objects, 33% free, 13MB/20MB, paused 8.209ms total 95.709ms
I/art: Background sticky concurrent mark sweep GC freed 217676(4MB) AllocSpace objects, 109(2MB) LOS objects, 29% free, 14MB/20MB, paused 9.443ms total 114.881ms
I/art: Background sticky concurrent mark sweep GC freed 182518(3MB) AllocSpace objects, 93(2MB) LOS objects, 25% free, 15MB/20MB, paused 6.674ms total 86.338ms
I/art: Background sticky concurrent mark sweep GC freed 164026(3MB) AllocSpace objects, 76(2MB) LOS objects, 22% free, 16MB/20MB, paused 9.409ms total 87.588ms
I/art: Background sticky concurrent mark sweep GC freed 145705(2MB) AllocSpace objects, 69(2MB) LOS objects, 18% free, 16MB/20MB, paused 7.693ms total 92.798ms
I/art: Background sticky concurrent mark sweep GC freed 125359(2MB) AllocSpace objects, 58(1856KB) LOS objects, 16% free, 17MB/20MB, paused 10.191ms total 91.015ms
I/art: Background sticky concurrent mark sweep GC freed 113336(2MB) AllocSpace objects, 48(1536KB) LOS objects, 14% free, 17MB/20MB, paused 13.313ms total 92.493ms
W/art: Suspending all threads took: 22.287ms
I/art: Background sticky concurrent mark sweep GC freed 98208(1836KB) AllocSpace objects, 45(1440KB) LOS objects, 11% free, 18MB/20MB, paused 30.666ms total 107.346ms
I/art: Background sticky concurrent mark sweep GC freed 93016(1728KB) AllocSpace objects, 39(1248KB) LOS objects, 10% free, 18MB/20MB, paused 11.004ms total 99.926ms
I/art: Background sticky concurrent mark sweep GC freed 77929(1436KB) AllocSpace objects, 29(988KB) LOS objects, 7% free, 19MB/20MB, paused 10.880ms total 77.800ms
I/art: Background sticky concurrent mark sweep GC freed 58569(1084KB) AllocSpace objects, 25(900KB) LOS objects, 7% free, 19MB/20MB, paused 8.786ms total 65.812ms
I/art: Background partial concurrent mark sweep GC freed 94732(1754KB) AllocSpace objects, 65(2MB) LOS objects, 40% free, 19MB/31MB, paused 10.270ms total 163.881ms
I/art: Background sticky concurrent mark sweep GC freed 367558(6MB) AllocSpace objects, 156(5MB) LOS objects, 34% free, 20MB/31MB, paused 10.957ms total 760.397ms
I/art: Background partial concurrent mark sweep GC freed 357702(6MB) AllocSpace objects, 148(5MB) LOS objects, 40% free, 22MB/36MB, paused 13.017ms total 238.560ms
I/art: Background sticky concurrent mark sweep GC freed 412501(7MB) AllocSpace objects, 163(6MB) LOS objects, 33% free, 24MB/36MB, paused 16.686ms total 212.615ms
I/art: Background sticky concurrent mark sweep GC freed 372145(6MB) AllocSpace objects, 139(5MB) LOS objects, 29% free, 25MB/36MB, paused 14.894ms total 157.727ms
I/art: Background sticky concurrent mark sweep GC freed 336952(5MB) AllocSpace objects, 125(4MB) LOS objects, 25% free, 27MB/36MB, paused 12.693ms total 141.556ms
I/art: Background sticky concurrent mark sweep GC freed 297349(5MB) AllocSpace objects, 107(4MB) LOS objects, 22% free, 28MB/36MB, paused 10.511ms total 240.796ms
I/art: Background partial concurrent mark sweep GC freed 295872(5MB) AllocSpace objects, 116(4MB) LOS objects, 35% free, 29MB/45MB, paused 14.058ms total 312.055ms
I/art: Background sticky concurrent mark sweep GC freed 475357(8MB) AllocSpace objects, 165(7MB) LOS objects, 30% free, 31MB/45MB, paused 13.709ms total 201.810ms
I/art: Background sticky concurrent mark sweep GC freed 426071(7MB) AllocSpace objects, 145(6MB) LOS objects, 26% free, 33MB/45MB, paused 15.473ms total 181.532ms
I/art: Background sticky concurrent mark sweep GC freed 380416(6MB) AllocSpace objects, 121(5MB) LOS objects, 23% free, 35MB/45MB, paused 15.181ms total 209.012ms
I/art: Background sticky concurrent mark sweep GC freed 324046(5MB) AllocSpace objects, 107(5MB) LOS objects, 19% free, 36MB/45MB, paused 14.514ms total 237.311ms
I/art: Background partial concurrent mark sweep GC freed 353205(6MB) AllocSpace objects, 112(5MB) LOS objects, 30% free, 37MB/53MB, paused 16.766ms total 366.247ms
W/art: Suspending all threads took: 5.089ms
I/art: Background sticky concurrent mark sweep GC freed 488154(8MB) AllocSpace objects, 148(7MB) LOS objects, 25% free, 39MB/53MB, paused 25.373ms total 255.885ms
I/art: Background sticky concurrent mark sweep GC freed 416853(7MB) AllocSpace objects, 124(6MB) LOS objects, 21% free, 41MB/53MB, paused 14.426ms total 197.298ms
I/art: Background sticky concurrent mark sweep GC freed 370573(6MB) AllocSpace objects, 108(5MB) LOS objects, 19% free, 42MB/53MB, paused 13.653ms total 183.978ms
I/art: Background sticky concurrent mark sweep GC freed 320876(5MB) AllocSpace objects, 94(4MB) LOS objects, 16% free, 44MB/53MB, paused 14.199ms total 195.097ms
W/art: Suspending all threads took: 5.686ms
I/art: Background sticky concurrent mark sweep GC freed 291842(4MB) AllocSpace objects, 78(3MB) LOS objects, 14% free, 45MB/53MB, paused 18.108ms total 171.417ms
I/art: Background sticky concurrent mark sweep GC freed 242667(4MB) AllocSpace objects, 67(3MB) LOS objects, 12% free, 46MB/53MB, paused 15.108ms total 150.489ms
I/art: Background partial concurrent mark sweep GC freed 315748(5MB) AllocSpace objects, 97(5MB) LOS objects, 25% free, 47MB/63MB, paused 14.929ms total 374.065ms
I/art: Background sticky concurrent mark sweep GC freed 485040(8MB) AllocSpace objects, 129(7MB) LOS objects, 21% free, 49MB/63MB, paused 16.835ms total 201.664ms
W/art: Suspending all threads took: 5.110ms
I/art: Background sticky concurrent mark sweep GC freed 416924(7MB) AllocSpace objects, 112(6MB) LOS objects, 18% free, 51MB/63MB, paused 17.534ms total 194.653ms
I/art: Background sticky concurrent mark sweep GC freed 370379(6MB) AllocSpace objects, 95(5MB) LOS objects, 15% free, 53MB/63MB, paused 17ms total 194.648ms
W/art: Suspending all threads took: 5.122ms
I/art: Background sticky concurrent mark sweep GC freed 321811(5MB) AllocSpace objects, 80(4MB) LOS objects, 13% free, 54MB/63MB, paused 21.046ms total 182.534ms
I/art: Background sticky concurrent mark sweep GC freed 287920(4MB) AllocSpace objects, 74(4MB) LOS objects, 11% free, 56MB/63MB, paused 16.712ms total 181.835ms
W/art: Suspending all threads took: 5.036ms
I/art: Background partial concurrent mark sweep GC freed 349561(5MB) AllocSpace objects, 102(5MB) LOS objects, 21% free, 56MB/72MB, paused 20.447ms total 457.924ms
W/art: Suspending all threads took: 6.597ms
I/art: Background sticky concurrent mark sweep GC freed 484487(8MB) AllocSpace objects, 120(7MB) LOS objects, 18% free, 59MB/72MB, paused 22.997ms total 243.940ms
I/art: Background sticky concurrent mark sweep GC freed 414121(6MB) AllocSpace objects, 102(6MB) LOS objects, 15% free, 61MB/72MB, paused 13.500ms total 201.300ms
W/art: Suspending all threads took: 5.263ms
I/art: Background sticky concurrent mark sweep GC freed 354973(5MB) AllocSpace objects, 87(5MB) LOS objects, 13% free, 62MB/72MB, paused 23.947ms total 329.016ms
W/art: Suspending all threads took: 11.720ms
I/art: Background partial concurrent mark sweep GC freed 463504(7MB) AllocSpace objects, 112(6MB) LOS objects, 19% free, 64MB/80MB, paused 39.772ms total 1.122s
W/art: Suspending all threads took: 6.685ms
I/art: Background sticky concurrent mark sweep GC freed 493519(8MB) AllocSpace objects, 117(7MB) LOS objects, 16% free, 67MB/80MB, paused 23.112ms total 448.592ms
I/art: Background partial concurrent mark sweep GC freed 527916(8MB) AllocSpace objects, 125(8MB) LOS objects, 19% free, 68MB/84MB, paused 19.825ms total 770.415ms
W/art: Suspending all threads took: 11.502ms
I/art: Background sticky concurrent mark sweep GC freed 483258(8MB) AllocSpace objects, 109(7MB) LOS objects, 16% free, 70MB/84MB, paused 34.591ms total 292.397ms
W/art: Suspending all threads took: 11.710ms
I/art: Background sticky concurrent mark sweep GC freed 433099(7MB) AllocSpace objects, 95(6MB) LOS objects, 13% free, 72MB/84MB, paused 29.721ms total 333.264ms
I/art: Background partial concurrent mark sweep GC freed 542239(9MB) AllocSpace objects, 122(8MB) LOS objects, 17% free, 74MB/90MB, paused 18.976ms total 588.777ms
I/art: Background sticky concurrent mark sweep GC freed 477749(7MB) AllocSpace objects, 106(7MB) LOS objects, 14% free, 77MB/90MB, paused 17.812ms total 287.416ms
I/art: Background sticky concurrent mark sweep GC freed 436031(7MB) AllocSpace objects, 91(6MB) LOS objects, 12% free, 78MB/90MB, paused 18.190ms total 240.779ms
W/art: Suspending all threads took: 5.386ms
I/art: Background sticky concurrent mark sweep GC freed 367329(6MB) AllocSpace objects, 78(5MB) LOS objects, 10% free, 80MB/90MB, paused 21.870ms total 234.304ms
W/art: Suspending all threads took: 6.010ms
I/art: Background sticky concurrent mark sweep GC freed 327623(5MB) AllocSpace objects, 66(4MB) LOS objects, 8% free, 82MB/90MB, paused 24.246ms total 260.789ms
I/art: Waiting for a blocking GC Alloc
I/art: Clamp target GC heap from 98MB to 96MB
I/art: Background partial concurrent mark sweep GC freed 419414(6MB) AllocSpace objects, 99(6MB) LOS objects, 14% free, 82MB/96MB, paused 23.092ms total 1.037s
I/art: WaitForGcToComplete blocked for 293.048ms for cause Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Clamp target GC heap from 107MB to 96MB
I/art: Alloc partial concurrent mark sweep GC freed 19884(338KB) AllocSpace objects, 5(380KB) LOS objects, 4% free, 91MB/96MB, paused 28.728ms total 601.537ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc sticky concurrent mark sweep GC freed 11697(200KB) AllocSpace objects, 2(152KB) LOS objects, 4% free, 91MB/96MB, paused 21.074ms total 81.978ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Clamp target GC heap from 107MB to 96MB
I/art: Alloc partial concurrent mark sweep GC freed 16275(280KB) AllocSpace objects, 5(380KB) LOS objects, 4% free, 91MB/96MB, paused 20.190ms total 554.216ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc sticky concurrent mark sweep GC freed 11543(185KB) AllocSpace objects, 0(0B) LOS objects, 4% free, 91MB/96MB, paused 19.041ms total 72.282ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Clamp target GC heap from 108MB to 96MB
I/art: Alloc partial concurrent mark sweep GC freed 9552(162KB) AllocSpace objects, 2(152KB) LOS objects, 4% free, 92MB/96MB, paused 21.291ms total 543.574ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc sticky concurrent mark sweep GC freed 5371(89KB) AllocSpace objects, 0(0B) LOS objects, 4% free, 92MB/96MB, paused 18.035ms total 66.913ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Waiting for a blocking GC Alloc
I/art: Clamp target GC heap from 108MB to 96MB
I/art: Alloc concurrent mark sweep GC freed 3(12KB) AllocSpace objects, 0(0B) LOS objects, 4% free, 92MB/96MB, paused 22.973ms total 543.478ms
I/art: WaitForGcToComplete blocked for 1.718s for cause Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 4% free, 92MB/96MB, paused 21.634ms total 70.486ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Waiting for a blocking GC Alloc
I/art: Clamp target GC heap from 108MB to 96MB
I/art: Alloc partial concurrent mark sweep GC freed 3726(61KB) AllocSpace objects, 0(0B) LOS objects, 4% free, 92MB/96MB, paused 16.981ms total 560.883ms
I/art: WaitForGcToComplete blocked for 514.263ms for cause Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 4% free, 92MB/96MB, paused 21.996ms total 85.113ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Waiting for a blocking GC Alloc
I/art: Clamp target GC heap from 108MB to 96MB
I/art: Alloc partial concurrent mark sweep GC freed 2414(37KB) AllocSpace objects, 0(0B) LOS objects, 4% free, 92MB/96MB, paused 21.919ms total 588.180ms
I/art: WaitForGcToComplete blocked for 559.727ms for cause Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc sticky concurrent mark sweep GC freed 1713(36KB) AllocSpace objects, 2(152KB) LOS objects, 4% free, 92MB/96MB, paused 16.797ms total 61.707ms
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Clamp target GC heap from 109MB to 96MB
I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 2% free, 93MB/96MB, paused 18.221ms total 575.577ms
W/art: Throwing OutOfMemoryError "Failed to allocate a 70 byte allocation with 2995320 free bytes and 2MB until OOM; failed due to fragmentation (required continguous free 4096 bytes for a new buffer where largest contiguous free 0 bytes)"
I/art: WaitForGcToComplete blocked for 173.009ms for cause HeapTrim
D/AndroidRuntime: Shutting down VM
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc sticky concurrent mark sweep GC freed 3(128B) AllocSpace objects, 0(0B) LOS objects, 2% free, 93MB/96MB, paused 936us total 9.245ms
I/art: Starting a blocking GC Alloc
I/art: Alloc partial concurrent mark sweep GC freed 5938631(91MB) AllocSpace objects, 0(0B) LOS objects, 40% free, 1859KB/3MB, paused 886us total 463.091ms
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.nikolai.engadgetnews, PID: 11216
java.lang.OutOfMemoryError: Failed to allocate a 70 byte allocation with 2995320 free bytes and 2MB until OOM; failed due to fragmentation (required continguous free 4096 bytes for a new buffer where largest contiguous free 0 bytes)
at com.android.dex.Dex$Section.readString(Dex.java:592)
at com.android.dex.Dex$StringTable.get(Dex.java:893)
at com.android.dex.Dex$TypeIndexToDescriptorTable.get(Dex.java:914)
at com.android.dex.Dex$TypeIndexToDescriptorTable.get(Dex.java:913)
at libcore.reflect.AnnotationAccess.getAnnotation(AnnotationAccess.java:201)
at libcore.reflect.AnnotationAccess.getDeclaredAnnotation(AnnotationAccess.java:169)
at java.lang.reflect.Field.getAnnotation(Field.java:252)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:108)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.ja
D/Error: ERR: exClass=java.lang.OutOfMemoryError
D/Error: ERR: exMsg=Failed to allocate a 70 byte allocation with 2995320 free bytes and 2MB until OOM; failed due to fragmentation (required continguous free 4096 bytes for a new buffer where largest contiguous free 0 bytes)
D/Error: ERR: file=Dex.java
D/Error: ERR: class=com.android.dex.Dex$Section
D/Error: ERR: method=readString line=592
D/Error: ERR: stack=java.lang.OutOfMemoryError: Failed to allocate a 70 byte allocation with 2995320 free bytes and 2MB until OOM; failed due to fragmentation (required continguous free 4096 bytes for a new buffer where largest contiguous free 0 bytes)
at com.android.dex.Dex$Section.readString(Dex.java:592)
at com.android.dex.Dex$StringTable.get(Dex.java:893)
at com.android.dex.Dex$TypeIndexToDescriptorTable.get(Dex.java:914)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.get
D/Error: ERR: TOTAL BYTES WRITTEN: 1932636
E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 1932728)
E/AndroidRuntime: Error reporting crash
android.os.TransactionTooLargeException: data parcel size 1932728 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at
android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:4425)
at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:90)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
Айфон мало держит заряд, разбираемся с проблемой вместе с AppLab
Перевод документов на английский язык: Важность и ключевые аспекты
В настоящий момент я работаю серверным Java разработчиком на нескольких небольших и не самых важных для компании проектахНа них я серверный...
Как сменить фрагмент в методе onNewIntent, если все происходит тут:
Есть приложение, в котором получаю данные с EditText и GPS и отправляю в БД MySQL удаленно через HttpURLConnectionЭто надо делать через каждые 15 секунд после...