Did you ever hear(see, do, anything else) vs. Have you ever(seen, done, and so on) heard? [closed]
The broad difference between the past tense and the present perfect construction is that the first describes an event at a specific time in the past, whereas the second describes an event which began in the past, but has current relevance. That’s putting it very simply, and for a fuller explanation you should consult a qualified English teacher, or a grammar book designed for non-native speakers (and I assume you are one).
In the first of your two examples, there is an assumed at any particular time between ever and trouble. The second shows a less frequent application of the present perfect construction, where it is used to talk about general experience up to the point of speaking. The question means Have you ever in your whole life read of Jonathan Wild?