How to Succeed in Graduate School: A Guide for Students and Advisors-2

本文为研究生提供了宝贵的建议,包括如何融入研究社区、参加学术会议、发表论文等,同时为导师提供了指导学生的建议。

4 Becoming Part of the Research Community

One of the most important things a graduate student should do is to become established as part of the research community. Your advisor can help with this process by funding confer- ence travel, encouraging you to publish research results early, collaborating on joint publications, introducing you to col- leagues, and promoting your work.

In turn, you can make yourself more visible by participat- ing in conferences and workshops, publishing papers on your

7

work, and meeting and maintaining contact with colleagues.

4.1 Attending Conferences

Attending conferences and workshops is valuable whether you present a paper or not. Some of the reasons to do so are:

  • You’ll meet people and have a chance to discuss your ideas and to hear theirs.

  • You’ll get a good sense of what the current state of re- search is, and will learn more about how to write confer- ence papers and give talks (sometimes by counterexam- ple).

  • You’ll probably realize that your ideas are more signifi- cant, relatively speaking, than you thought. A common reaction is “I could write a better paper than this!”

If you’re giving a talk you’ll gain even more visibility, and will have an opportunity to make an impression on other re- searchers. Some tips for preparing your talk to make this impression as positive as possible:

  • Give a practice talk, especially if you tend to get stage fright. Be sure to invite people who will give you con- structive, but useful, feedback.

  • Make sure your talk fits in the time slot allocated. There’s nothing worse than a speaker who rushes through the last ten slides, or skips from the middle of the talk to the conclusion. A good rule is to allocate 2-3 minutes per slide, on average.

  • It’s better to be somewhat abstract than to get bogged down in technical details – but be sure you give enough detail to make a convincing case. Your paper should fill in the missing details, so that people can read it to get a more in-depth understanding. Know your audience: you’ll have to give more background to a general audi- ence, and more technical detail to audiences that are very familiar with the field of research you’re discussing.

  • Use examples and pictures to illustrate and clarify your ideas.

  • Learn by observation: try to imitate qualities of talks that you like, and avoid things that other speakers do that bother you.

  • Talk about your ideas informally whenever you get the chance, so that the talk will come more naturally and, hopefully, you’ll have a chance to respond to and think about questions that might get asked at the talk.

  • Make sure your slides are readable and as simple as pos- sible. Never put up a slide with tiny text and say “I know you can’t read this, but...”

Try to relax. Don’t read from a script or word-for-word from your slides, and don’t talk too fast. Be confident: you know more about your work (flaws and all) than anyone else.

Parberry [1988contains some more suggestions for organiz- ing and presenting a talk, directed at theoretical computer scientists.

4.2 Publishing Papers

Publishing your ideas is important for several reasons: it gives you a source of feedback from people who read your papers; it establishes you as a member of the research community (useful for getting a job down the line); and it forces you to clarify your ideas and to fit them in the context of the current state of research in your field.

There are two key properties of a good paper: significant content – original, important ideas that are well developed and tested – and good writing style. The degree to which the paper’s content has to be “significant” depends on where you’re submitting it. Preliminary ideas and work in progress are more suitable for a workshop or symposium; well devel- oped, extensively tested ideas are more appropriate for a jour- nal. One way to decide where your paper should be submitted is to read papers in potentially appropriate publications (last year’s conference proceedings; current journal issues). An- other method is to show a draft or outline of the paper to your advisor or other colleagues and ask their advice.

If you have a great idea, but present it poorly, your pa- per probably won’t be accepted. Be sure you know what the point of the paper is, and state it clearly and repeatedly. The same goes for the key technical ideas. Don’t make the reader work to figure out what’s important – tell them explicitly. Otherwise, they might get it wrong, if they bother to finish reading the paper at all. State the problem you’re adderss- ing, why it’s important, how you’re solving it, what results you have, how other researchers have addressed the same or similar problems, and why your method is different or better.

Write for the audience that you expect to read the paper, just as you would plan a talk. Give more background for gen- eral audiences, less background and more technical detail for specialized audiences. Use a running exmaple if possible, es- pecially if your paper is dense with equations and algorithms.

Don’t try to put every idea in your thesis into one confer- ence paper. Break it down into pieces, or write one or two longer journal articles.

As you refine your ideas, you can re-publish in new forms, but be sure you’re adding new material, not just rehashing the same ideas. Some papers start as short workshop papers, evolve into conference papers, and eventually – with the ad- dition of detailed empirical results or formal proofs – become journal articles. It’s usually okay to publish the same or sub- stantially similar papers in multiple workshops, but papers

8

for conferences and journals generally have to be original, un- published work.

It is critical that any paper you plan to submit be read by someone else first, if only to check for typos, grammatical errors, and style. A good reviewer will give you feedback on the organization and content of the paper as well (see Section 3.4). The more tightly refereed the publication you’re submitting to, the more trouble you should go to in order to have it pre-reviewed. For a workshop paper, having your advisor read it over (assuming you can convince them to do so!) is probably enough. For a refereed conference, have one or two other graduate students read it as well. For a journal paper, you should probably find researchers who are active in the field, preferably at other institutions (to give breadth), read it over and give you comments. This is where the network of colleagues you should build (Section 4.3) comes in handy.

If you go through multiple revisions of a paper, don’t expect the same person (even—perhaps especially—your advisor) to keep reading new drafts. You should only give a revised draft to your advisor or another reviewer if the paper has changed substantially and they’ve said that they’re willing to re-read it.

If your paper is rejected, keep trying! Take the reviews to heart and try to rewrite the paper, addressing the reviewer’s comments. You’ll get more substantial and useful reviews from journals than conferences or workshops. Often a jour- nal paper will be returned for revisions; usually a conference paper will just be accepted or rejected outright. After read- ing the review the first time, put it aside. Come back to it later, reading the paper closely to decide whether the criti- cisms were valid and how you can address them.

You will often find that reviewers make criticisms that are off-target because they misinterpreted some aspect of your paper, or just because they’re lazy. If so, don’t let it get to you – just rewrite that part of your paper more clearly so that the same misunderstanding won’t happen again. It’s frustrat- ing to have a paper rejected because of a misunderstanding, but at least it’s something you can fix. On the other hand, criticisms of the content of the paper may require more sub- stantial revisions – rethinking your ideas, running more tests, or redoing an analysis. (On the third hand, sometimes a pa- per is rejected for neither of these reasons, but because of politics: somebody on the reviewing committee dislikes your topic, your advisor, your writing style, or even you personally for some reason. This is all the more reason to try resubmit- ting to a different conference or journal!)

4.3 Networking

One of the most important skills you should be learning in graduate school is how to “network.” Breaking into the re- search community requires attending conferences, meeting es- tablished researchers, and making yourself known. Network- ing is a learned skill, so you shouldn’t expect to be an expert

at it immediately; but it is also a skill that you can, and should, learn in order to be a successful member of the re- search community.

Just going to conferences and standing in the corner isn’t enough. Especially if you’re not normally an outgoing per- son, you have to make a conscious effort to meet and build relationships with other researchers. Presenting papers is a good way to do this, since people will often approach you to discuss your presentation. Introducing yourself to people whose presentations you found interesting, and asking a rel- evant question or describing related research you’re doing, is also a good way to meet people. Sometimes it’s easier to meet other graduate students than senior researchers—this is fine, since those graduate students will provide contacts to the se- nior people they know, and somebody they’ll be senior people themselves (as will you)!

You should talk about your research interests every chance you get. (But be sure to spend some time listening, too: you’ll learn more this way, and people will feel that your conversa- tions are a two-way street.) Have summaries of your work of various lengths and levels of detail mentally prepared, so that you can answer the inevitable “So what are you working on?” intelligently and clearly. If someone expresses an interest in your work, follow up! Send them e-mail talking about new ideas or asking questions; send them drafts of papers; ask them for drafts of their papers and send them comments. (If you do this, they’ll be sure to remember you!) Bring business cards with your e-mail address to conferences to help new acquaintances jog their memory.

Maintain the relationships you form via e-mail, and by re- establishing contact at each workshop or conference you at- tend. If you work at it, and use your initial acquaintances to meet new people, you’ll find that your “network” grows rapidly. (Agre [1994has some excellent suggestions for net- working on the Internet.)

Sometimes these contacts will grow into opportunities to do collaborative research. Seize these opportunities: you will meet more people, often become exposed to new methods of doing research or new subfields within your research area, and the responsibility you feel towards your collaborator may give you more of an incentive to stay motivated and keep accomplishing something.

Other professional activities can bring you into the research network as well: volunteer for program committees, send your resume to a book review editor, offer to give seminars at other universities, write conference and workshop papers and send them to people you’ve met or would like to meet, or organize a workshop on your subfield at a larger conference. Summer internships at research laboratories or even other universities are a good way to get an idea of what the “real world” of research is like, to meet more new colleagues, and to get a different perspective on research problems in your field.

Mentoring junior graduate students and undergraduates is a good investment in the long run (besides providing them a valuable service and making you feel useful and knowledge-

9

able).
Finding specific mentors can be very useful. Especially

if you feel that you are isolated at your institution, having a colleague at another institution who can give you advice, feedback on drafts of papers, and suggestions for research di- rections can be extremely valuable.

5 Advice for Advisors

In order to be a good advisor, you have to relate to your grad- uate students as individuals, not just as anonymous research assistants or tickets to tenure and co-authored publications. Work with all of your graduate students, not just those whom you feel most comfortable with, or who are interested in the problems you’re most excited about. Try to get to know your students personally and professionally. Help them to identify their strengths and weaknesses, to build on the former, and to work on overcoming the latter. Give them honest evaluations of their work and performance: don’t just assume that they know how they’re doing and what you think of them.

Read this paper and others like it with an eye towards dis- covering which aspects of the graduate experience your stu- dents may be having trouble with, or may not realize the importance of. Try to see the experience from their perspec- tive, which will be different for each student, because each student has a different background and different talents and goals.

The roles of an advisor include:

  • Guiding students’ research: helping them to select a topic, write a research proposal, perform the research, evaluate it critically, and write the dissertation.

  • Getting them involved in the wider research community: introducing them to colleagues, collaborating on research projects with them, funding conference travel, encourag- ing them to publish papers, nominating them for awards and prizes.

  • Finding financial support: providing research assis- tantships or helping them to find fellowships, and finding summer positions.

  • Finding a position after graduation: helping them to find and apply for postdoctoral positions, faculty positions, and/or jobs in industry; supporting their applications with strong recommendations; and helping them to make contacts.

    Although guiding your students’ research is normally viewed as the central task of an advisor, the other roles are also critical to their long-term success. Section 4.3 contains advice for students on networking. You can help them in this process by funding and encouraging travel to conferences and paper publication, and by introducing them and talking about their research to colleagues. Nigel Ward’s useful tips on what not

to do are included as an appendix to this paper. A book that was suggested to me is [Phillips et al., 1994], but I haven’t actually seen it so I can’t recommend it personally.

5.1 Interacting With Students

Especially for a new advisor, setting the right tone for student interactions is a difficult task. Different students respond best to different approaches – and, of course, different advisors have different personal styles. Some of the tradeoffs that have to be made in each advisor-student relationship are:

  • Amount of direction: self-directed/hands-off vs. “spoon- feeding” topics and research projects.

  • Personal interactions and psychological support: do they want advice on career, family, and the like? Are you willing and able to give it, or to find someone else to advise them?

  • Amount and type of criticism: general directions vs. spe- cific suggestions for improvement.

  • Frequency of interaction: daily vs. once a semester.

    It helps to establish regular meeting times and to discuss ex- pectations (both yours and your students’) about what can and should be accomplished during these meetings. Encour- age them to develop relationships with other faculty members, students, and colleagues, to get a different perspective and to get feedback you may not be able to give.

    To improve the atmosphere of your interactions:

  • Meet over lunch or coffee to make interactions more re- laxed and less stressful.

  • Strive to maintain an open, honest relationship. Respect your students as colleagues.

  • Tell them if you think they’re asking for too much or too little time or guidance.

    Advisors should be aware of both long-term and short-term needs. What should the student’s goals over the next few years be? Help your student identify ways that the two of you – as a team – can meet these goals. Advise the student on the criteria for a successful qualifying exam, thesis proposal, and dissertation. Help prepare the student for a future research career.

    In the short term, a good advisor will work with students to set priorities and to find a balance between doing research, reading, writing, satisfying TA and RA duties, publishing, and coursework. Although advisors may not be able to give advice on all administrative aspects of graduate school, they should at least know the appropriate people to refer students to for assistance with degree requirements, funding, and so on.

10

When you meet with your students, pay attention to them. Try to help them to identify their interests, concerns, and goals, not just how they can meet what you see as good in- terests, concerns, and goals. Know what they’re working on, and what you discussed last time. Take notes during meetings and review them if you have to.

Give them productive feedback, not just a noncommittal “ok, sure” or a destructive “why on earth do you want to do that?” Remember that your students are still learning. If you tell them that a problem they’re interested in has already been explored by Professor X, make sure you follow up with a reference that they have access to, and a discussion as to whether the problem remains a worthwhile area to work on, or whether there are new open issues raised by Professor X’s work, at the next meeting.

When reviewing a student’s paper or proposal, write com- ments on the paper itself: verbal comments aren’t as useful. Give the feedback promptly, or it won’t be much help. See the section on feedback (Section 3.4) for suggestions about giving useful comments. Don’t just wait until they hand you some- thing to read: insist on written drafts of proposals, papers, etc. Help them develop their rough ideas into publishable papers. Give them specific, concrete suggestions for what to do next, especially if they seem to be floundering or making little progress.

Advisor-student relationships can break down if the advisor is setting goals that are too high or too low, or if the advisor is exploiting the student to meet the advisor’s needs (getting a promotion, increasing the advisor’s publication record, doing the advisor’s research), not the student’s. Fortunately, the student’s needs and the advisor’s needs in most of these cases are not conflicting.

Encourage your students to choose a topic that you’re both interested in and that you’re knowledgeable about (or very interested in learning more about). Make sure that they have the appropriate background to understand the problem, and that the methodology and solution they identify are appro- priate and realistic. Give them pointers to useful references and help them find them (this can be a mysterious, difficult process for graduate students). Make sure they’re aware of other researchers and labs who are doing similar work, and if possible, arrange for them to visit these labs or meet the researchers at seminars or conferences.

Women faculty often feel obligated to mentor every woman student in the department, attend every committee meeting, and get involved in every debate, whether they want to or not. While you can’t solve all of the problems in the world, you can at least make a difference by giving other women (and men, for that matter) the sense that you do care, and that you think women’s issues are important, even if you don’t have time (or the inclination) to get involved with every problem.

5.2 Social Aspects of Advising

The relationships you develop with your students will vary. With some, the relationship will be purely professional; with others, you may become closer friends. As an advisor, it is your responsibility to ensure that your position of authority over the student is never abused. As mentioned previously, graduate students should not be used as a means to a promo- tion or a better publication record. These will be side effects of good work in conjunction with your students, but should not be the goal of your relationship.

Becasue you are in a position of authority over your stu- dents, you must make sure that you both know where the boundaries are. For example, getting a student to help you move some furniture is usually quite easy if you’re doing a good job as an advisor, since they feel indebted to you for your advice and support. This isn’t a problem in and of it- self. However, using explicit or implicit threats to force the student to help you out is a severe violation of professional ethics. Your students are also your colleagues, and should be treated as such. A good question to ask yourself before ask- ing a student for a favor is whether you would feel confortable asking the head of your department for the same favor. If the answer to this question is “no,” then you may be exploiting your position and abusing your relationship, and you should seriously reconsider your motivations and behavior.

In my opinion, it is never appropriate to develop an in- timate relationship with one of your own students. If this should happen, you should not continue to advise them (whether the relationship continues or not). Not only would this be a clear case of sexual harassment, but your judgment about the student’s professional life cannot be objectively sep- arated from personal feelings in a close relationship.

Dating students (or even asking them out where the im- plication of a romantic relationship may exist) is a bad idea, even if the student is not one of your advisees. They are bound to feel intimidated and uncomfortable, and at many universities this violates the sexual harassment policy.

Read your university’s policy on harassment, and err on the side of conservatism when in doubt, for your sake and the student’s.

6 All Work and No Play...

Finding a balance between work, play, and other activities isn’t easy. Different people will give you very different advice. Some people say you should be spending eighty or ninety percent of your waking hours working on your thesis. Others (myself included) think that this is unrealistic and unhealthy, and that it’s important for your mental and physical health to have other active interests.

If you have a family, you will have to balance your priorities even more carefully. Graduate school isn’t worth risking your personal relationships over; be sure that you save time and

11

energy to focus on the people who matter to you.
One of the keys to balancing your life is to develop a sched- ule that’s more or less consistent. You may decide that you will only work during the days, and that evenings are for your hobbies. Or you might decide that afternoons are for social- izing and exercising, and work late at night. I decided very early on in graduate school that weekends were for me, not

for my thesis, and I think it helped me to stay sane.
Many graduate students hit the doldrums around the end of the second or beginning of the third year, when they’re finishing up their coursework and trying to focus in on a thesis topic. Sometimes this process can take quite a while. Try to find useful, enjoyable activities that can take your mind off of the thesis. Sing in a choir, learn a foreign language, study the history of ancient Greece, garden, or knit. If you schedule regular activities (rehearsals, tennis lessons), you will probably find it easier to avoid drifting aimlessly from day to

day.
In the final push to finish your thesis, though, you will al-

most certainly have less time for social activities than you used to. Your friends may start to make you feel guilty, whether they intend to or not. Warn them in advance that you expect to turn down lots of invitations, and it’s nothing personal – but you need to focus on your thesis for a while. Then you’ll be all done and free as a bird! (Until the next phase of your life starts...)

7 Issues for Women

Although this paper started out from a discussion about the problems women face in graduate school, it has evolved into something that I think is relevant for everyone, not just women. This is not to say, however, that there aren’t special problems faced by women.

In many cases, women and men face the same obstacles in graduate school, but react differently to them. For women, the additional factors that are sometimes (but not always) present include isolation, low self-esteem, harassment and dis- crimination, unusual time pressures arising from family re- sponsibilities, lack of a support network, and lack of relevant experience. Having an unsupportive advisor can thus become much more of a problem for women than for men. I hope that to some extent, this paper will help both women and advi- sors of women to provide the supportive, positive environment that all graduate students deserve.

Part of the reason that I changed the focus of the paper is that there have been many articles written recently on the subject of women scientists and women graduate students. These include [Spertus, 1992, Toth, 1988, Hall and Sandler, b, Hall and Sandler, c, Hall and Sandler, a, Sandler and Hall, 1986, NSF, 1989, Leveson, 1989, Strok, 1992]. McKay [1988talks about issues relevant for minority faculty members, many of which pertain to minority graduate students. The systers mailing list is an electronic resource for women in com-

puter science; send e-mail to systers-request@pa.dec.com for more information.

8 On Finishing

Despite how difficult graduate school can be at times, the benefits are significant. Of course, you’ll learn useful pro- fessional skills like doing research, formulating problems and critically evaluating alternative solutions, giving written and oral presentations of your work, and interacting with other re- searchers. But graduate school—and in particular the process of formulating, researching, and writing a dissertation—gives you confidence in your ability to tackle hard problems and to become an expert in a new field. A fellow Ph.D. put it much better than I can:

...it isn’t just that I can write technical things and I can talk to other researchers with confidence—I can talk to almost any authority figure with confidence. Partly this is because I now know what it is to be an expert in something, and although I respect other peoples’ expertise in their areas of specialization, I also know that I’m just as respectable and they (usu- ally) aren’t any more so than I. I also think I can write about other things/in other areas, provided I’ve done my homework and learned the area. I feel EMPOWERED!!! And I would never have gotten this from a CS programming job or even a masters degree.

Of course, there are also the incalculable benefits of finish- ing the dissertation. Even though it can leave you at loose ends (what will you do with your weekends, now that you no longer have to work on your thesis?) there’s often a feeling of euphoria, heightened by exhaustion, when you finally hand in your thesis. As the person quoted above put it:

I think an oft-noted bad thing about finishing is ad- justing to no longer having a long term, ever-elusive goal. But now that five months have gone by, I find I’m much more efficient in my work because I no longer have that awful weight hanging by a thread over my head, and am much happier, more relaxed, more light-hearted.

Conclusions

12

9

In addition to the papers I have cited directly in the article, I found a variety of other resources to be useful, and have included them in the References section.

The UC Berkeley Graduate is a newsletter published by the UC Berkeley Graduate Division with articles of general interest to graduate students. I found this publication very informative both during graduate school and while writing

this article. A number of particularly interesting articles are included in the References section.

Several articles ([Bundy et al., 1986, Bental, 1992, Chap- man, 1988]) give general advice on graduate school and doing research. Guidelines and suggestions for reviewing papers are given in [Smith, 1990and [Shriver, 1990].

A number of articles on writing proposals and successfully applying for research grants are available ([Somerville, 1982, White, 1983, White, 1975, Lefferts, 1978]). How to find a job, and how to prepare for the job search during graduate school, is the topic of [Feibelman, 1993].

Graduate school is not an easy process, and too many students are thwarted and intimidated by unsupportive or unskilled advisors, lack of knowledge about what graduate school is all about, inflexible bureaucracies, and a myriad of other obstacles. I have tried to give advice that graduate students and caring advisors can use to lessen some of these obstacles.

Acknowledgements

I would like to thank Susan Epstein, Diana Gordon, and De- vika Subramanian for the original discussion that led to writ- ing this paper. Many people provided useful feedback on an earlier draft that was circulated on the Internet, especially Mark Kantrowitz, John W. Buchanan (who suggested the idea and wrote the original draft for Section 5.2), and Marti Hearst. I gracefully acknowledge defeat with respect to the original title (it was supposed to be “How to be a Good Graduate Student / Advisor },” but was too often misinter- preted as “How to be a Good (Graduate Student) Advisor”); thanks to Peter Soderquist for the first half of the new title. Any deficiencies remaining in the paper are entirely my fault!

A How to be a Terrible Thesis Ad- visor

by Nigel Ward (a young faculty member and advisor who hopes others can learn from his mistakes)

  • Assign students thesis topics based on the section head- ings in your grant proposal, or on the boxes of the flowchart for your master plan.

  • When someone brings up a research paper, tell anecdotes about the author, his or her advisor, and his or her col- leagues. This will impress students that who you know is more important than what you do.

  • When laying out your laboratory, give first priority to minimizing the cost of cable, last priority to good work- places for students, and no priority to fostering interac- tion among students.

  • Read your students’ papers at most once.

When honest differences of opinion arise, paper them over with words. For example, say “well, we could talk about this forever, but I think we’re all working towards the same basic idea, let’s call it a ‘neologistic/noetic knowledge representation’. Now let’s move on.”

Regarding other schools of thought, make sure students know just enough to be able to point out the “fatal flaws” in each, and so can be good foot soldiers in the crusade for your own approach. A useful phrase is “why do you want to waste your time reading that?”

Never visit the laboratory; learn about students’ work only from what they tell you.

Define your research aims with catch phrases (“dynamic X,” “emergent Y,” “the Z problem,” etc.).

Have students handle computer system administration, and let them think it counts as research.

Mumble.

Assign older students to guide the younger ones.

Involve students in decision-making for unimportant things. For example, you can easily while away an hour of seminar deciding who should be discussion leader for what chapter of the reading.

Share your most trivial thoughts with your students. Better yet, bring them up as seminar discussion topics (“in the shower this morning, it struck me that whites- pace is really important. Let’s think about whitespace from an AI perspective”).

Avoid conflicts with your students; in particular, don’t be too demanding.

If a student reveals that he is confused about what counts as meaningful research, ridicule him.

Take no interest in what courses your students are taking.

Pick up ideas from going to conferences, then bring them up in seminar without explaining from whom you got them or explaining the context in which they arose.

Plan for research seminars to last at least two hours.
Avoid meeting with students individually. Do all advis-

ing out in public, at seminars.

Never go near the laboratory in the evenings or on week- ends.

Always come unprepared for seminars; you’re smart enough to fake it.

13

  • Never do any programming yourself. After all, you went through that once, and now you’re an ideas man (or woman).

  • Let your students see you rushing to meet deadlines.

  • Avoid critical discussions of research strategy. A useful phrase is “We’ll do it this way. Why? Because I’m the professor and you’re a student.”

  • Expect nothing much from your students, and subtly let them know this.

  • Give all your students the same research topic, but with slightly different names. If this is the same topic as your own dissertation topic, all the better.

  • Let your students see your grant proposals and learn the art of doublethink.

  • Enforce disciplinary boundaries. For example, say, “that sounds like the sort of thing that people in software engi- neering would work on, so let’s leave that topic alone,” or “why do you want to worry about that? that’s a software engineering issue.”

  • Never suggest your students contact other professors or other researchers.

  • Let your students submit articles to third-rate journals.

  • If a student’s work is not giving the results expected,

    belittle her.

  • Encourage your students to work on fashionable prob- lems.

  • State your opinions loudly and frequently, so your stu- dents know what to write in their theses.

    References

    [Agre, 1982Philip E. Agre. What to read: A biased guide to AI literacy for the beginner. Technical Report Working Paper 239, MIT AI Lab, November 1982.

    [Agre, 1994Phil Agre. Networking
    network, 1994. Available via
    as http://www.cs.indiana.edu/HTMLit/net- working.on.net.html; or send a message to rre- request@weber.ucsd.edu with the subject line ’archive send network’.

    [Bental, 1992Diana Bental. Thesis prevention: Advice to PhD supervisors. AISB Quarterly No. 80 (Newsletter of the Society for the Study of Artificial Intelligence and Simula- tion of Behaviour), pages 58–60, Summer 1992. (Published under the alias ‘The Siblings of Perpetual Prototyping’).

[Bundy et al., 1986Alan Bundy, Ben du Boulay, Jim Howe, and Gordon Plotkin. The researchers’ bible. Technical Report DAI Teaching Paper No. 4, Dept. of Artificial In- telligence, University of Edinburgh, September 1986.

[Chapman, 1988David Chapman. How to do research at the MIT AI lab. Technical Report AI Working Paper 316, MIT, October 1988.

[Division, 1986aUC Berkeley Graduate Division. Finding money for dissertation research/writing. The Graduate, II(3), Fall 1986.

[Division, 1986bUC Berkeley Graduate Division. Studying for the qualifying exam. The Graduate, II(3), Fall 1986.

[Division, 1986cUC Berkeley Graduate Division. Writing your thesis. The Graduate, II(1), Spring 1986.

[Division, 1987aUC Berkeley Graduate Division. Interview- ing for a faculty position. The Graduate, III(2), Fall 1987.

[Division, 1987bUC Berkeley Graduate Division. The mak- ing of a successful proposal. The Graduate, III(1), Spring 1987.

[Division, 1988UC Berkeley Graduate Division. Choosing your thesis or dissertation topic. The Graduate, IV(2), Fall 1988.

[Division, 1989UC Berkeley Graduate Division. Beating the isolation blues. The Graduate, V(1), Spring 1989.

[Feibelman, 1993Peter J. Feibelman. A Ph.D. Is Not Enough. Addison Wesley, 1993.

[Hall and Sandler, aRoberta M. Hall and Bernice R. San- dler. Academic mentoring for women students and faculty: A new look at an old way to get ahead.

[Hall and Sandler, bRoberta M. Hall and Bernice R. San- dler. The classroom climate: A chilly one for women?

[Hall and Sandler, cRoberta M. Hall and Bernice R. San- dler. Out of the classroom: A chilly campus climate for women?

[Kantrowitz and DiGennaro, 1994Mark Kantrowitz and Joann P. DiGennaro. The Prentice Hall Guide to Schol- arships and Fellowships for Math and Science Students. Simon & Schuster, 1994.

[Lefferts, 1978Robert Lefferts. Getting a Grant: How to Write Successful Grant Proposals. 1978.

[Leveson, 1989Nancy Leveson. Women in computer science: A report for the NSF CISE Cross-Disciplinary Activities Advisory Committee, December 1989.

[McKay, 1988Nellie Y. McKay. Minority faculty in [main- stream white] academia, 1988. Chapter 5.

on

the mosaic

14

[NSF, 1989NSF. An NSF study and report about women in computing research. Computing Research News, Summer 1989.

[Parberry, 1988Ian Parberry. How to present a paper in the- oretical computer science: A speaker’s guide for students. SIGACT News, 19(2):42–47, 1988. Available by anonymous ftp from ftp.unt.edu.

[Parberry, 1989Ian Parberry. A guide for new referees in theoretical computer science. SIGACT News, 20(4):92–109, 1989. Available by anonymous ftp from ftp.unt.edu.

[Phillips et al., 1994Gerald M. Phillips, Dennis Gouran, Scott Kuehn, and Jula Wood. Survival in the Academy: A Guide for Young Academics. Hampton Press, 1994.

[Sandler and Hall, 1986Bernice R. Sandler and Roberta M. Hall. The campus climate revisited: Chilly for women fac- ulty, administrators, and graduate students, October 1986.

[Shriver, 1990Bruce D. Shriver. The benefits of quality ref- ereeing. COMPUTER, pages 10–16, April 1990. Also in- cludes COMPUTER’s guidelines for referees.

[Sloman, Aaron Sloman. Notes on presenting theses. Avail- able by anonymous ftp from ftp.cs.bham.ac.uk, in directory pub/dist/poplog/teach.

[Smith, 1990Alan Jay Smith. The task of the referee. COM- PUTER, pages 65–71, April 1990.

[Somerville, 1982Bill Somerville. Where proposals fail: A foundation executive’s basic list of what to do and not do when requsting funding. The Grantsmanship Center News, Jan/Feb 1982.

[Spertus, 1992Ellen Spertus. Why are there so few female computer scientists?, 1992. Expected to become an MIT AI Lab Technical Report.

[Strok, 1992Dale Strok. Women in AI. IEEE Expert, 7(4):7– 21, August 1992.

[Toth, 1988Emily Toth. Women in academia. In The Aca- demics’ Handbook. Duke University Press, 1988. Chapter 4.

[White, 1975Virginia White. Grants: How to Find Out About Them and What to Do Next. Plenum Press, 1975.

[White, 1983Virginia White. Grant Proposals That Suc- ceeded. Plenum Press, 1983.

15 

--------- beginning of system 2025-07-14 19:01:46.868 1569-2215 ActivityManager system_server I Force stopping org.cocos2d.demo appid=10051 user=0: from pid 5432 --------- beginning of main 2025-07-14 19:01:46.869 2159-2159 ContextImpl com.android.coreservice W Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 android.content.ContextWrapper.startService:664 com.android.coreservice.CoreBroadcastReceiver.onReceive:54 android.app.ActivityThread.handleReceiver:3424 2025-07-14 19:01:43.961 1569-1576 chatty system_server I uid=1000(system) FinalizerDaemon expire 46 lines 2025-07-14 19:01:43.961 1569-1576 System system_server W A resource failed to call close. 2025-07-14 19:01:46.870 1904-1904 CarrierSvcBindHelper com.android.phone D No carrier app for: 0 2025-07-14 19:01:46.935 1569-3446 ActivityManager system_server I Force stopping org.cocos2d.demo appid=10051 user=0: from pid 5445 2025-07-14 19:01:46.936 1904-1904 CarrierSvcBindHelper com.android.phone D No carrier app for: 0 2025-07-14 19:01:46.937 2159-2159 ContextImpl com.android.coreservice W Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 android.content.ContextWrapper.startService:664 com.android.coreservice.CoreBroadcastReceiver.onReceive:54 android.app.ActivityThread.handleReceiver:3424 2025-07-14 19:01:46.959 1569-3446 ActivityManager system_server I START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.cocos2d.demo/org.cocos2dx.javascript.AppActivity} from uid 2000 2025-07-14 19:01:46.974 2159-2159 ContextImpl com.android.coreservice W Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 android.content.ContextWrapper.startService:664 com.android.coreservice.CoreBroadcastReceiver.onReceive:45 android.app.ActivityThread.handleReceiver:3424 2025-07-14 19:01:46.979 1423-1423 allocator@2.0-s and...raphics.allocator@2.0-service I type=1400 audit(0.0:1117): avc: denied { ioctl } for path="/dev/fastpipe" dev="tmpfs" ino=7232 ioctlcmd=6867 scontext=u:r:hal_graphics_allocator_default:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1 2025-07-14 19:01:46.998 5451-5451 nativebridge pid-5451 D PreInitializeNativeBridge name=zygote64 instruction_set=arm64 2025-07-14 19:01:46.999 1569-1586 ActivityManager system_server I Start proc 5451:org.cocos2d.demo/u0a51 for activity org.cocos2d.demo/org.cocos2dx.javascript.AppActivity 2025-07-14 19:01:47.014 5451-5451 nativebridge pid-5451 W Failed to bind-mount /data/local/cfg-nnayn/ as /proc/cpuinfo: Not a directory 2025-07-14 19:01:47.017 5451-5451 Zygote pid-5451 I seccomp disabled by setenforce 0 2025-07-14 19:01:47.018 5451-5451 rg.cocos2d.dem pid-5451 I Late-enabling -Xcheck:jni 2025-07-14 19:01:47.036 5451-5451 libnb pid-5451 V enter native_bridge2_initialize /data/user/0/org.cocos2d.demo/code_cache arm64 2025-07-14 19:01:47.036 5451-5451 houdini pid-5451 D [5451] Initialize library(version: 9.0.7a_z.38597 RELEASE)... successfully. ---------------------------- PROCESS STARTED (5451) for package org.cocos2d.demo ---------------------------- 2025-07-14 19:01:47.037 5451-5451 libnb pid-5451 V enter native_bridge2_isCompatibleWith 2 2025-07-14 19:01:47.139 2159-2159 ContextImpl com.android.coreservice W Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 android.content.ContextWrapper.startService:664 com.android.coreservice.CoreBroadcastReceiver.onReceive:54 android.app.ActivityThread.handleReceiver:3424 2025-07-14 19:01:47.037 5451-5451 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) identical 63 lines 2025-07-14 19:01:47.037 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 2 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 3 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge3_isPathSupported /data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/lib/arm64:/data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/base.apk!/lib/arm64-v8a 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 3 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge3_initAnonymousNamespace libandroid.so:libaaudio.so:libc.so:libcamera2ndk.so:libdl.so:libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libicui18n.so:libicuuc.so:libjnigraphics.so:liblog.so:libmediandk.so:libm.so:libnativewindow.so:libneuralnetworks.so:libOpenMAXAL.so:libOpenSLES.so:libRS.so:libstdc++.so:libsync.so:libvulkan.so:libwebviewchromium_plat_support.so:libz.so, /data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/lib/arm64:/data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/base.apk!/lib/arm64-v8a 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 3 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge3_isPathSupported /data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/lib/arm64:/data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/base.apk!/lib/arm64-v8a 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 3 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge3_createNamespace classloader-namespace, (null), /data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/lib/arm64:/data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/base.apk!/lib/arm64-v8a, /data:/mnt/expand:/data/user/0/org.cocos2d.demo 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 4 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 3 2025-07-14 19:01:47.157 5451-5451 libnb org.cocos2d.demo V enter native_bridge3_linkNamespaces libandroid.so:libaaudio.so:libc.so:libcamera2ndk.so:libdl.so:libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libicui18n.so:libicuuc.so:libjnigraphics.so:liblog.so:libmediandk.so:libm.so:libnativewindow.so:libneuralnetworks.so:libOpenMAXAL.so:libOpenSLES.so:libRS.so:libstdc++.so:libsync.so:libvulkan.so:libwebviewchromium_plat_support.so:libz.so 2025-07-14 19:01:47.164 1569-1576 System system_server W A resource failed to call close. 2025-07-14 19:01:47.164 1569-1576 chatty system_server I uid=1000(system) FinalizerDaemon identical 19 lines 2025-07-14 19:01:47.164 1569-1576 System system_server W A resource failed to call close. 2025-07-14 19:01:47.198 1721-2100 ziparchive com.android.systemui W Unable to open '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk': No such file or directory 2025-07-14 19:01:47.198 1721-2100 ndroid.systemu com.android.systemui E Failed to open APK '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk' I/O error 2025-07-14 19:01:47.198 1721-2100 ResourcesManager com.android.systemui E failed to add asset path /data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk 2025-07-14 19:01:47.198 1721-2100 PackageManager com.android.systemui W Failure retrieving resources for org.cocos2d.demo 2025-07-14 19:01:47.198 1721-2100 ziparchive com.android.systemui W Unable to open '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk': No such file or directory 2025-07-14 19:01:47.198 1721-2100 ndroid.systemu com.android.systemui E Failed to open APK '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk' I/O error 2025-07-14 19:01:47.198 1721-2100 ResourcesManager com.android.systemui E failed to add asset path /data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk 2025-07-14 19:01:47.198 1721-2100 PackageManager com.android.systemui W Failure retrieving resources for org.cocos2d.demo 2025-07-14 19:01:47.198 1721-2100 ziparchive com.android.systemui W Unable to open '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk': No such file or directory 2025-07-14 19:01:47.198 1721-2100 ndroid.systemu com.android.systemui E Failed to open APK '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk' I/O error 2025-07-14 19:01:47.198 1721-2100 ResourcesManager com.android.systemui E failed to add asset path /data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk 2025-07-14 19:01:47.198 1721-2100 PackageManager com.android.systemui W Failure retrieving resources for org.cocos2d.demo 2025-07-14 19:01:47.198 1721-2100 ziparchive com.android.systemui W Unable to open '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk': No such file or directory 2025-07-14 19:01:47.198 1721-2100 ndroid.systemu com.android.systemui E Failed to open APK '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk' I/O error 2025-07-14 19:01:47.198 1721-2100 ResourcesManager com.android.systemui E failed to add asset path /data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk 2025-07-14 19:01:47.198 1721-2100 PackageManager com.android.systemui W Failure retrieving resources for org.cocos2d.demo 2025-07-14 19:01:47.198 1721-2100 ziparchive com.android.systemui W Unable to open '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk': No such file or directory 2025-07-14 19:01:47.198 1721-2100 ndroid.systemu com.android.systemui E Failed to open APK '/data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk' I/O error 2025-07-14 19:01:47.198 1721-2100 ResourcesManager com.android.systemui E failed to add asset path /data/app/org.cocos2d.demo-qLW_1oeK0d6GzjNEfloC_Q==/base.apk 2025-07-14 19:01:47.198 1721-2100 PackageManager com.android.systemui W Failure retrieving resources for org.cocos2d.demo 2025-07-14 19:01:47.224 5451-5451 Cocos2dxActivity org.cocos2d.demo D Cocos2dxActivity onCreate: org.cocos2dx.javascript.AppActivity@f1c691f, savedInstanceState: null 2025-07-14 19:01:47.260 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_isCompatibleWith 3 2025-07-14 19:01:47.260 5451-5451 libnb org.cocos2d.demo V enter native_bridge3_loadLibraryExt /data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/lib/arm64/libcocos2djs.so, 2, 0x3 2025-07-14 19:01:47.512 5451-5451 libnb org.cocos2d.demo V native_bridge3_loadLibraryExt: 0x763877d4eac0 2025-07-14 19:01:47.513 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline JNI_OnLoad, trampoline_addr 0x76388e6af000 2025-07-14 19:01:47.513 5451-5451 JniHelper org.cocos2d.demo D JniHelper::setJavaVM(0x76388ede6928), pthread_self() = 129987584391496 2025-07-14 19:01:47.513 5451-5451 main org.cocos2d.demo D cocos_jni_env_init 2025-07-14 19:01:47.513 5451-5451 Cocos2dxHelper org.cocos2d.demo D isSupportLowLatency:true 2025-07-14 19:01:47.515 5451-5451 Cocos2dxHelper org.cocos2d.demo D sampleRate: 48000, framesPerBuffer: 1024 2025-07-14 19:01:47.515 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetAudioDeviceInfo, trampoline_addr 0x76388e6af020 2025-07-14 19:01:47.515 5451-5451 JniImp org.cocos2d.demo D nativeSetAudioDeviceInfo: sampleRate: 48000, bufferSizeInFrames: 1024 2025-07-14 19:01:47.516 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetApkPath, trampoline_addr 0x76388e6af040 2025-07-14 19:01:47.517 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetContext, trampoline_addr 0x76388e6af060 2025-07-14 19:01:47.520 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxActivity_getGLContextAttrs, trampoline_addr 0x76388e6af080 2025-07-14 19:01:47.521 5451-5451 OpenGLRenderer org.cocos2d.demo D Skia GL Pipeline 2025-07-14 19:01:47.522 5451-5451 SDKWrapper org.cocos2d.demo W project.json 中不存在 serviceClassPath 字段 2025-07-14 19:01:47.523 5451-5451 Cocos2dxActivity org.cocos2d.demo D model=ASUS_AI2401_A 2025-07-14 19:01:47.523 5451-5451 Cocos2dxActivity org.cocos2d.demo D product=ASUS_AI2401_A 2025-07-14 19:01:47.523 5451-5451 Cocos2dxActivity org.cocos2d.demo D isEmulator=false 2025-07-14 19:01:47.546 5451-5451 Cocos2dxActivity org.cocos2d.demo D onResume() 2025-07-14 19:01:47.599 5451-5451 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxGLSurfaceView_nativeOnSizeChanged, trampoline_addr 0x76388e6af0a0 2025-07-14 19:01:47.599 5451-5480 <no-tag> org.cocos2d.demo I fastpipe: Connect success 2025-07-14 19:01:47.601 5451-5480 <no-tag> org.cocos2d.demo I fastpipe: Connect success 2025-07-14 19:01:47.601 5451-5480 HostConnection org.cocos2d.demo D HostRPC::connect sucess: app=org.cocos2d.demo, pid=5451, tid=5480, this=0x7638888262c0 2025-07-14 19:01:47.602 5451-5480 HostConnection org.cocos2d.demo D queryAndSetGLESMaxVersion select gles-version: 3.1 hostGLVersion:46 process:org.cocos2d.demo 2025-07-14 19:01:47.604 5451-5480 ConfigStore org.cocos2d.demo I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 2025-07-14 19:01:47.604 5451-5480 ConfigStore org.cocos2d.demo I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0 2025-07-14 19:01:47.604 5451-5480 OpenGLRenderer org.cocos2d.demo I Initialized EGL, version 1.4 2025-07-14 19:01:47.604 5451-5480 OpenGLRenderer org.cocos2d.demo D Swap behavior 1 2025-07-14 19:01:47.605 5451-5478 <no-tag> org.cocos2d.demo I fastpipe: Connect success 2025-07-14 19:01:47.605 5451-5478 HostConnection org.cocos2d.demo D HostRPC::connect sucess: app=org.cocos2d.demo, pid=5451, tid=5478, this=0x76387a5f7b00 2025-07-14 19:01:47.610 5451-5480 EGL_emulation org.cocos2d.demo D eglCreateContext: 0x76389273ba80: maj 3 min 1 rcv 4 2025-07-14 19:01:47.610 5451-5478 HostConnection org.cocos2d.demo D queryAndSetGLESMaxVersion select gles-version: 3.1 hostGLVersion:46 process:org.cocos2d.demo 2025-07-14 19:01:47.617 5451-5478 EGL_emulation org.cocos2d.demo D eglCreateContext: 0x76389273bf00: maj 3 min 1 rcv 4 2025-07-14 19:01:47.638 5451-5478 vndksupport org.cocos2d.demo D Loading /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace. 2025-07-14 19:01:47.639 5451-5480 eglCodecCommon org.cocos2d.demo E glUtilsParamSize: unknow param 0x000082da 2025-07-14 19:01:47.639 5451-5480 eglCodecCommon org.cocos2d.demo E glUtilsParamSize: unknow param 0x000082e5 2025-07-14 19:01:47.640 5451-5478 vndksupport org.cocos2d.demo D Loading /vendor/lib64/hw/gralloc.default.so from current namespace instead of sphal namespace. 2025-07-14 19:01:47.642 5451-5480 HostConnection org.cocos2d.demo D ExtendedRCEncoderContext GL_VERSION return OpenGL ES 3.1 v1 2025-07-14 19:01:47.644 5451-5480 eglCodecCommon org.cocos2d.demo E glUtilsParamSize: unknow param 0x00008c29 2025-07-14 19:01:47.645 5451-5480 eglCodecCommon org.cocos2d.demo E glUtilsParamSize: unknow param 0x000087fe 2025-07-14 19:01:47.666 5451-5478 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit, trampoline_addr 0x76388e6af0c0 2025-07-14 19:01:47.666 5451-5478 main org.cocos2d.demo D cocos_android_app_init 2025-07-14 19:01:47.667 5451-5478 HostConnection org.cocos2d.demo D ExtendedRCEncoderContext GL_VERSION return OpenGL ES 3.1 v1 2025-07-14 19:01:47.671 5451-5480 EGL_emulation org.cocos2d.demo E tid 5480: eglSurfaceAttrib(1493): error 0x3009 (EGL_BAD_MATCH) 2025-07-14 19:01:47.671 5451-5480 OpenGLRenderer org.cocos2d.demo W Failed to set EGL_SWAP_BEHAVIOR on surface 0x76387a0f6180, error=EGL_BAD_MATCH 2025-07-14 19:01:47.672 5451-5478 JniImp org.cocos2d.demo D nativeInit: 1440, 2560, 2025-07-14 19:01:47.686 5451-5478 jswrapper org.cocos2d.demo D Initializing V8, version: 8.0.426.16 2025-07-14 19:01:47.709 5451-5451 Cocos2dxActivity org.cocos2d.demo D onWindowFocusChanged() hasFocus=true 2025-07-14 19:01:47.548 2159-2159 ContextImpl com.android.coreservice W Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 android.content.ContextWrapper.startService:664 com.android.coreservice.CoreBroadcastReceiver.onReceive:54 android.app.ActivityThread.handleReceiver:3424 2025-07-14 19:01:47.712 2159-2159 ContextImpl com.android.coreservice W Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 android.content.ContextWrapper.startService:664 com.android.coreservice.CoreBroadcastReceiver.onReceive:70 android.app.ActivityThread.handleReceiver:3424 2025-07-14 19:01:47.747 1569-1576 System system_server W A resource failed to call close. 2025-07-14 19:01:47.747 1569-1576 chatty system_server I uid=1000(system) FinalizerDaemon identical 25 lines 2025-07-14 19:01:47.747 1569-1576 System system_server W A resource failed to call close. 2025-07-14 19:01:47.775 5451-5478 jswrapper org.cocos2d.demo D libuv version: 1.13.1 2025-07-14 19:01:47.780 5451-5488 jswrapper org.cocos2d.demo D Debugger listening..., visit [ devtools://devtools/bundled/js_app.html?v8only=true&ws=0.0.0.0:6086/00010002-0003-4004-8005-000600070008 ] in chrome browser to debug! 2025-07-14 19:01:47.780 5451-5488 jswrapper org.cocos2d.demo D For help see https://nodejs.org/en/docs/inspector 2025-07-14 19:01:48.368 5451-5478 jswrapper org.cocos2d.demo D JS: Enable batch GL commands optimization! 2025-07-14 19:01:49.262 5451-5478 NetworkSecurityConfig org.cocos2d.demo D No Network Security Config specified, using platform default 2025-07-14 19:01:49.264 5451-5478 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (light greylist, reflection) 2025-07-14 19:01:49.264 5451-5478 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (light greylist, reflection) 2025-07-14 19:01:49.264 5451-5478 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (light greylist, reflection) 2025-07-14 19:01:49.269 5451-5478 cocos2d-x org.cocos2d.demo D find in flash memory dirPath(/data/user/0/org.cocos2d.demo/files/temp) 2025-07-14 19:01:49.322 5451-5478 jswrapper org.cocos2d.demo E ScriptEngine::onGetStringFromFile stream not found, possible missing file. 2025-07-14 19:01:49.322 5451-5478 jswrapper org.cocos2d.demo E ScriptEngine::runScript script stream, buffer is empty! 2025-07-14 19:01:49.322 5451-5478 jswrapper org.cocos2d.demo E [ERROR] Failed to invoke require, location: C:/ProgramData/cocos/editors/Creator/2.4.13/resources/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_global.cpp:299 2025-07-14 19:01:49.362 5451-5478 jswrapper org.cocos2d.demo E ScriptEngine::evalString catch exception: 2025-07-14 19:01:49.382 5451-5478 jswrapper org.cocos2d.demo E ERROR: Uncaught ReferenceError: self is not defined, location: src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:0:0 STACK: [0]anonymous@src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:2 [1]anonymous@src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:3 [2]anonymous@jsb-adapter/jsb-engine.js:2975 [3]download@jsb-adapter/jsb-engine.js:2984 [4]downloadScript@jsb-adapter/jsb-engine.js:2971 [5]a@src/cocos2d-jsb.28d62.js:16668 [6]anonymous@src/cocos2d-jsb.28d62.js:16678 [7]retry@src/cocos2d-jsb.28d62.js:18111 [8]download@src/cocos2d-jsb.28d62.js:16663 [9]load@src/cocos2d-jsb.28d62.js:17318 [10]94.e.exports@src/cocos2d-jsb.28d62.js:17134 [11]_flow@src/cocos2d-jsb.28d62.js:17579 [12]async@src/cocos2d-jsb.28d62.js:17574 [13]anonymous@src/cocos2d-jsb.28d62.js:17261 [14]forEach@src/cocos2d-jsb.28d62.js:18189 [15]94.e.exports@src/cocos2d-jsb.28d62.js:17244 [16]_flow@src/cocos2d-jsb.28d62.js:17579 [17]anonymous@src/cocos2d-jsb.28d62.js:17586 [18]98.e.exports@src/cocos2d-jsb.2 2025-07-14 19:01:49.382 5451-5478 debug info org.cocos2d.demo D Uncaught Exception: - location : (see stack) - msg : Uncaught ReferenceError: self is not defined - detail : [0]anonymous@src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:2 [1]anonymous@src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:3 [2]anonymous@jsb-adapter/jsb-engine.js:2975 [3]download@jsb-adapter/jsb-engine.js:2984 [4]downloadScript@jsb-adapter/jsb-engine.js:2971 [5]a@src/cocos2d-jsb.28d62.js:16668 [6]anonymous@src/cocos2d-jsb.28d62.js:16678 [7]retry@src/cocos2d-jsb.28d62.js:18111 [8]download@src/cocos2d-jsb.28d62.js:16663 [9]load@src/cocos2d-jsb.28d62.js:17318 [10]94.e.exports@src/cocos2d-jsb.28d62.js:17134 [11]_flow@src/cocos2d-jsb.28d62.js:17579 [12]async@src/cocos2d-jsb.28d62.js:17574 [13]anonymous@src/cocos2d-jsb.28d62.js:17261 [14]forEach@src/cocos2d-jsb.28d62.js:18189 [15]94.e.exports@src/cocos2d-jsb.28d62.js:17244 [16]_flow@src/cocos2d-jsb.28d62.js:17579 [17]anonymous@src/cocos2d-jsb.28d62.js:17586 [18]98.e.exports@src/cocos2d-jsb.28d62.js:17642 [19] 2025-07-14 19:01:49.383 5451-5478 jswrapper org.cocos2d.demo D JS: [ERROR]: (see stack) Uncaught ReferenceError: self is not defined [0]anonymous@src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:2 [1]anonymous@src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:3 [2]anonymous@jsb-adapter/jsb-engine.js:2975 [3]download@jsb-adapter/jsb-engine.js:2984 [4]downloadScript@jsb-adapter/jsb-engine.js:2971 [5]a@src/cocos2d-jsb.28d62.js:16668 [6]anonymous@src/cocos2d-jsb.28d62.js:16678 [7]retry@src/cocos2d-jsb.28d62.js:18111 [8]download@src/cocos2d-jsb.28d62.js:16663 [9]load@src/cocos2d-jsb.28d62.js:17318 [10]94.e.exports@src/cocos2d-jsb.28d62.js:17134 [11]_flow@src/cocos2d-jsb.28d62.js:17579 [12]async@src/cocos2d-jsb.28d62.js:17574 [13]anonymous@src/cocos2d-jsb.28d62.js:17261 [14]forEach@src/cocos2d-jsb.28d62.js:18189 [15]94.e.exports@src/cocos2d-jsb.28d62.js:17244 [16]_flow@src/cocos2d-jsb.28d62.js:17579 [17]anonymous@src/cocos2d-jsb.28d62.js:17586 [18]98.e.exports@src/cocos2d-jsb.28d62.js:17642 [19]_flow@src/cocos2d-jsb.28d62.js:17579 2025-07-14 19:01:49.384 5451-5478 jswrapper org.cocos2d.demo E ScriptEngine::evalString script src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js, failed! 2025-07-14 19:01:49.384 5451-5478 jswrapper org.cocos2d.demo E [ERROR] Failed to invoke require, location: C:/ProgramData/cocos/editors/Creator/2.4.13/resources/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_global.cpp:299 2025-07-14 19:01:49.428 5451-5478 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnSurfaceChanged, trampoline_addr 0x76388e6af0e0 2025-07-14 19:01:49.429 5451-5478 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender, trampoline_addr 0x76388e6af100 2025-07-14 19:01:49.652 5451-5478 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume, trampoline_addr 0x76388e6af120 2025-07-14 19:01:49.667 5451-5478 renderer org.cocos2d.demo D (626): Device caps: maxVextexTextures: 32, maxFragUniforms: 1024, maxTextureUints: 32, maxVertexAttributes: 16, maxDrawBuffers: 1, maxColorAttatchments: 1 2025-07-14 19:01:49.856 1569-1583 system_server system_server W Failed to determine oat file name for dex location /data/app/org.cocos2d.demo-DSE6AeZBhpmsfM8p5sz99g==/base.apk: Dalvik cache directory does not exist 2025-07-14 19:01:49.856 1569-1583 ActivityManager system_server I Displayed org.cocos2d.demo/org.cocos2dx.javascript.AppActivity: +2s896ms 2025-07-14 19:01:49.865 1436-1436 surfaceflinger surfaceflinger I type=1400 audit(0.0:1139): avc: denied { read write } for path="/dev/fastpipe" dev="tmpfs" ino=7232 scontext=u:r:hal_graphics_composer_default:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1 2025-07-14 19:01:49.904 1436-1524 SurfaceFlinger surfaceflinger W Attempting to set client state on removed layer: Splash Screen org.cocos2d.demo#0 2025-07-14 19:01:49.904 1436-1524 SurfaceFlinger surfaceflinger W Attempting to destroy on removed layer: Splash Screen org.cocos2d.demo#0 2025-07-14 19:01:49.937 5451-5478 jswrapper org.cocos2d.demo D JS: Cocos Creator v2.4.13 2025-07-14 19:01:50.037 5451-5478 jswrapper org.cocos2d.demo D JS: 平板 宽度=750 高度=1333.3333333333335 2025-07-14 19:01:50.041 5451-5478 jswrapper org.cocos2d.demo D JS: 平板 宽度 适配后 宽度=750.375 高度=1334 2025-07-14 19:01:50.249 5451-5478 jswrapper org.cocos2d.demo D JS: 【YPSDK】 设置 登录回调 成功 2025-07-14 19:01:50.250 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] UIManager open view: UI_Entry 2025-07-14 19:01:50.428 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:01:51.176 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 11 lines 2025-07-14 19:01:51.246 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:01:51.245 1433-1433 ldinit ldinit I type=1400 audit(0.0:1140): avc: denied { read } for name="partitions" dev="proc" ino=4026532050 scontext=u:r:ldinit:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=1 2025-07-14 19:01:51.245 1433-1433 ldinit ldinit I type=1400 audit(0.0:1140): avc: denied { open } for path="/proc/partitions" dev="proc" ino=4026532050 scontext=u:r:ldinit:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=1 2025-07-14 19:01:51.330 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:01:59.903 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 95 lines 2025-07-14 19:01:59.976 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.001 1569-1583 memtrack system_server E Couldn't load memtrack module 2025-07-14 19:02:00.001 1569-1583 android.os.Debug system_server W failed to get memory consumption info: -1 2025-07-14 19:02:00.048 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.149 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 1 line 2025-07-14 19:02:00.216 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.256 5451-5478 jswrapper org.cocos2d.demo D JS: [ERROR]: 10s后,仍然未登录成功,直接进入游戏 2025-07-14 19:02:00.266 5451-5478 jswrapper org.cocos2d.demo D JS: Load game config success: [object Object] 2025-07-14 19:02:00.267 5451-5478 jswrapper org.cocos2d.demo D JS: 游戏本地配置加载成功 6 2025-07-14 19:02:00.281 5451-5478 jswrapper org.cocos2d.demo D JS: Load remote config success: [object Object] 2025-07-14 19:02:00.282 5451-5478 jswrapper org.cocos2d.demo D JS: 远程配置加载成功 13 2025-07-14 19:02:00.300 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.368 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.436 5451-5494 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection) 2025-07-14 19:02:00.436 5451-5497 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection) 2025-07-14 19:02:00.436 5451-5493 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection) 2025-07-14 19:02:00.436 5451-5502 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection) 2025-07-14 19:02:00.442 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.486 5451-5493 rg.cocos2d.dem org.cocos2d.demo W Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B (light greylist, reflection) 2025-07-14 19:02:00.512 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.578 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.582 5451-5478 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxDownloader_nativeOnProgress, trampoline_addr 0x76388e6af140 2025-07-14 19:02:00.583 5451-5478 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxDownloader_nativeOnFinish, trampoline_addr 0x76388e6af160 2025-07-14 19:02:00.675 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:00.824 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 2 lines 2025-07-14 19:02:00.908 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:01.080 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] load excel done 20 2025-07-14 19:02:01.083 5451-5478 jswrapper org.cocos2d.demo D JS: 游戏数据表加载成功 799 2025-07-14 19:02:01.085 5451-5478 jswrapper org.cocos2d.demo D JS: [ERROR]: 初始化数据 2025-07-14 19:02:01.092 5451-5478 jswrapper org.cocos2d.demo D JS: [ERROR]: [game-logger] load user data error: [object Object] 2025-07-14 19:02:01.121 5451-5478 jswrapper org.cocos2d.demo D JS: Loaded main bundle [object Object] 2025-07-14 19:02:01.122 5451-5478 jswrapper org.cocos2d.demo D JS: Common分包下载 28 2025-07-14 19:02:01.144 5451-5478 jswrapper org.cocos2d.demo D JS: Loaded main bundle [object Object] 2025-07-14 19:02:01.145 5451-5478 jswrapper org.cocos2d.demo D JS: Home分包下载 22 2025-07-14 19:02:01.162 5451-5478 debug info org.cocos2d.demo D Uncaught Exception: - location : - msg : unhandledRejectedPromise - detail : TypeError: Cannot read property 'userUid' of null stacktrace: [0]406.window.__awaiter@src/cocos2d-jsb.28d62.js:71530 [1]t.onInitWhiteName@assets/main/index.0a7c4.jsc:16936 [2]t._loadGame@assets/main/index.0a7c4.jsc:16756 [3]anonymous@assets/main/index.0a7c4.jsc:16771 2025-07-14 19:02:01.162 5451-5478 jswrapper org.cocos2d.demo D JS: [ERROR]: unhandledRejectedPromise TypeError: Cannot read property 'userUid' of null stacktrace: [0]406.window.__awaiter@src/cocos2d-jsb.28d62.js:71530 [1]t.onInitWhiteName@assets/main/index.0a7c4.jsc:16936 [2]t._loadGame@assets/main/index.0a7c4.jsc:16756 [3]anonymous@assets/main/index.0a7c4.jsc:16771 2025-07-14 19:02:01.188 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] auto release all resources: ["UI_Entry"] 2025-07-14 19:02:01.323 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:01.479 5451-5478 jswrapper org.cocos2d.demo D JS: 登陆时间 1752490921479 2025-07-14 19:02:01.482 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] 发送埋点 _uma.custom.gameProgress 章节1_0波 2025-07-14 19:02:01.484 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] UIManager open view: UI_GameView 2025-07-14 19:02:01.535 5451-5478 AudioPlayerProvider org.cocos2d.demo I deviceSampleRate: 48000, bufferSizeInFrames: 192 2025-07-14 19:02:01.535 5451-5478 AudioPlayerProvider org.cocos2d.demo D Android API level: 28 2025-07-14 19:02:01.535 5451-5478 AudioMixerController org.cocos2d.demo V In the constructor of AudioMixerController! 2025-07-14 19:02:01.535 5451-5478 <no-tag> org.cocos2d.demo D PlayerBase::PlayerBase() 2025-07-14 19:02:01.535 5451-5478 <no-tag> org.cocos2d.demo D TrackPlayerBase::TrackPlayerBase() 2025-07-14 19:02:01.536 5451-5478 libOpenSLES org.cocos2d.demo I Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2) 2025-07-14 19:02:01.536 1434-5232 AudioFlinger audioserver W createTrack_l(): mismatch between requested flags (00000104) and output flags (00000002) 2025-07-14 19:02:01.536 1434-5232 AudioFlinger audioserver D Client defaulted notificationFrames to 960 for frameCount 2052 2025-07-14 19:02:01.537 5451-5478 AudioTrack org.cocos2d.demo W AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 2052 2025-07-14 19:02:01.538 1707-2033 bt_btif com.android.bluetooth E register_notification_rsp: Avrcp device is not connected, handle: 0x0 2025-07-14 19:02:01.538 1707-2033 chatty com.android.bluetooth I uid=1002(bluetooth) BluetoothAvrcpH identical 4 lines 2025-07-14 19:02:01.538 1707-2033 bt_btif com.android.bluetooth E register_notification_rsp: Avrcp device is not connected, handle: 0x0 2025-07-14 19:02:01.535 1413-1413 writer android.hardware.audio@2.0-service I type=1400 audit(0.0:1143): avc: denied { ioctl } for path="/dev/fastpipe" dev="tmpfs" ino=7232 ioctlcmd=6869 scontext=u:r:hal_audio_default:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1 2025-07-14 19:02:01.538 1413-2919 audio_hw_hal android.hardware.audio@2.0-service D raw_start_output_stream, stream=0xf5f1b000, sampleRate=48000, channel=2, bps=16, bufSize=4096 2025-07-14 19:02:01.539 5451-5478 AudioEngineImpl org.cocos2d.demo V play2d, _audioPlayers.size=0 2025-07-14 19:02:01.539 5451-5478 AudioPlayerProvider org.cocos2d.demo V (@assets/assets/game/native/c1/c1e23d2f-b7dc-44d4-91a4-8774e9abf939.261eb.mp3) file size: 179648 2025-07-14 19:02:01.540 5451-5478 UrlAudioPlayer org.cocos2d.demo V Current UrlAudioPlayer instance count: 1 2025-07-14 19:02:01.540 5451-5478 UrlAudioPlayer org.cocos2d.demo V UrlAudioPlayer::prepare: @assets/assets/game/native/c1/c1e23d2f-b7dc-44d4-91a4-8774e9abf939.261eb.mp3, SL_DATALOCATOR_ANDROIDFD, 98, 6980012, 179648 2025-07-14 19:02:01.540 5451-5478 <no-tag> org.cocos2d.demo D PlayerBase::PlayerBase() 2025-07-14 19:02:01.540 5451-5478 <no-tag> org.cocos2d.demo D TrackPlayerBase::TrackPlayerBase() 2025-07-14 19:02:01.541 1452-2087 NuPlayerDriver mediaserver D NuPlayerDriver(0xf4419800) created, clientPid(5451) 2025-07-14 19:02:01.542 1452-5511 GenericSource mediaserver D FileSource remote 2025-07-14 19:02:01.535 1413-1413 writer android.hardware.audio@2.0-service W type=1300 audit(0.0:1143): arch=40000003 syscall=54 per=8 success=yes exit=0 a0=6 a1=80046869 a2=f5f0f020 a3=f5f0f020 items=0 ppid=1 auid=4294967295 uid=1041 gid=1005 euid=1041 suid=1041 fsuid=1041 egid=1005 sgid=1005 fsgid=1005 tty=(none) ses=4294967295 exe="/system/vendor/bin/hw/android.hardware.audio@2.0-service" subj=u:r:hal_audio_default:s0 key=(null) 2025-07-14 19:02:01.544 1452-5510 NuPlayerDriver mediaserver D notifyListener_l(0xf4419800), (1, 0, 0, -1), loop setting(0, 0) 2025-07-14 19:02:01.535 1362-1362 auditd pid-1362 W type=1327 audit(0.0:1143): proctitle="/vendor/bin/hw/android.hardware.audio@2.0-service" 2025-07-14 19:02:01.545 1452-2087 NuPlayerDriver mediaserver D start(0xf4419800), state is 4, eos is 0 2025-07-14 19:02:01.545 1452-5510 GenericSource mediaserver I start 2025-07-14 19:02:01.547 1452-5514 OMXClient mediaserver I IOmx service obtained 2025-07-14 19:02:01.547 1458-1458 OMXMaster media.codec I makeComponentInstance(OMX.google.mp3.decoder) in omx@1.0-service process 2025-07-14 19:02:01.548 1458-1458 OMXNodeInstance media.codec E setConfig(0xf4f2c120:google.mp3.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001) 2025-07-14 19:02:01.548 1452-5514 ACodec mediaserver I codec does not support config priority (err -2147483648) 2025-07-14 19:02:01.548 1458-1458 OMXNodeInstance media.codec E getConfig(0xf4f2c120:google.mp3.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: Undefined(0x80001001) 2025-07-14 19:02:01.549 1452-5514 MediaCodec mediaserver I MediaCodec will operate in async mode 2025-07-14 19:02:01.549 1410-1410 AshmemAllocator android.hidl.allocator@1.0-service W ashmem_create_region(8192) returning hidl_memory(0x76391702c100, 8192) 2025-07-14 19:02:01.550 1410-1410 chatty android.hidl.allocator@1.0-service I uid=1000(system) allocator@1.0-s identical 2 lines 2025-07-14 19:02:01.550 1410-1410 AshmemAllocator android.hidl.allocator@1.0-service W ashmem_create_region(8192) returning hidl_memory(0x76391702c100, 8192) 2025-07-14 19:02:01.551 1410-1410 AshmemAllocator android.hidl.allocator@1.0-service W ashmem_create_region(9216) returning hidl_memory(0x76391702c100, 9216) 2025-07-14 19:02:01.551 1410-1410 chatty android.hidl.allocator@1.0-service I uid=1000(system) allocator@1.0-s identical 2 lines 2025-07-14 19:02:01.552 1410-1410 AshmemAllocator android.hidl.allocator@1.0-service W ashmem_create_region(9216) returning hidl_memory(0x76391702c100, 9216) 2025-07-14 19:02:01.553 1434-5232 AudioFlinger audioserver W createTrack_l(): mismatch between requested flags (00000008) and output flags (00000002) 2025-07-14 19:02:01.553 1434-5232 AudioFlinger audioserver D Client defaulted notificationFrames to 3760 for frameCount 11280 2025-07-14 19:02:01.554 1452-5510 NuPlayerDriver mediaserver D notifyListener_l(0xf4419800), (6, 0, 0, -1), loop setting(0, 1) 2025-07-14 19:02:01.597 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:01.617 5451-5478 jswrapper org.cocos2d.demo D JS: 背景底图时间差 133 2025-07-14 19:02:01.675 1434-1539 AudioFlinger audioserver D mixer(0xf3483640) throttle end: throttle time(10) 2025-07-14 19:02:01.774 1434-1539 AudioFlinger audioserver D mixer(0xf3483640) throttle end: throttle time(10) 2025-07-14 19:02:01.817 1452-5510 NuPlayerDriver mediaserver D notifyListener_l(0xf4419800), (211, 0, 0, 20), loop setting(0, 1) 2025-07-14 19:02:02.016 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] 格子保底数量: 1 2025-07-14 19:02:02.018 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] 触发格子保底: 0 2025-07-14 19:02:02.020 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 1 line 2025-07-14 19:02:02.021 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] 触发格子保底: 0 2025-07-14 19:02:02.075 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.075 1452-5510 NuPlayerDriver mediaserver D notifyListener_l(0xf4419800), (211, 0, 0, 20), loop setting(0, 1) 2025-07-14 19:02:02.203 5451-5478 AudioEngineImpl org.cocos2d.demo V play2d, _audioPlayers.size=1 2025-07-14 19:02:02.203 5451-5478 AudioPlayerProvider org.cocos2d.demo V (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) file size: 3305 2025-07-14 19:02:02.204 5451-5478 AudioPlayerProvider org.cocos2d.demo V FileInfo (0x763874c2e030), Waiting preload (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) to finish ... 2025-07-14 19:02:02.204 5451-5506 AudioPlayerProvider org.cocos2d.demo V AudioPlayerProvider::preloadEffect: (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) 2025-07-14 19:02:02.204 5451-5506 AudioDecoderProvider org.cocos2d.demo V url:@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3, extension:.mp3 2025-07-14 19:02:02.204 5451-5506 AudioDecoderMp3 org.cocos2d.demo V Create AudioDecoderMp3 2025-07-14 19:02:02.205 5451-5506 mp3reader org.cocos2d.demo V skipped ID3 tag, new starting offset is 172 (0x00000000000000ac) 2025-07-14 19:02:02.205 5451-5506 mp3reader org.cocos2d.demo V subsequent header is fff38064 2025-07-14 19:02:02.205 5451-5506 mp3reader org.cocos2d.demo V found subsequent frame #2 at 380 2025-07-14 19:02:02.205 5451-5506 mp3reader org.cocos2d.demo V subsequent header is fff38264 2025-07-14 19:02:02.205 5451-5506 mp3reader org.cocos2d.demo V found subsequent frame #3 at 588 2025-07-14 19:02:02.205 5451-5506 mp3reader org.cocos2d.demo V subsequent header is fff38264 2025-07-14 19:02:02.205 5451-5506 mp3reader org.cocos2d.demo V found subsequent frame #4 at 797 2025-07-14 19:02:02.245 5451-5506 AudioDecoderMp3 org.cocos2d.demo I Original audio info: numChannels: 2, sampleRate: 22050, bitPerSample: 16, containerSize: 16, channelMask: 3, endianness: 2, numFrames: 8640, duration: 0.391837, total size: 34560 2025-07-14 19:02:02.245 5451-5506 AudioDecoder org.cocos2d.demo D Decoding (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) to pcm data wasted 40.580002ms 2025-07-14 19:02:02.245 5451-5506 AudioDecoder org.cocos2d.demo V Resample: 22050 --> 48000 2025-07-14 19:02:02.245 5451-5506 AudioResampler org.cocos2d.demo V resampler load 0 -> 6 MHz due to delta +6 MHz from quality 2 2025-07-14 19:02:02.245 5451-5506 AudioResampler org.cocos2d.demo V Create cubic Resampler 2025-07-14 19:02:02.245 5451-5506 AudioDecoder org.cocos2d.demo V resample() 18808 output frames 2025-07-14 19:02:02.247 5451-5506 AudioDecoder org.cocos2d.demo V outFrames: 18808 2025-07-14 19:02:02.247 5451-5506 AudioDecoder org.cocos2d.demo V resample() complete 2025-07-14 19:02:02.247 5451-5506 AudioDecoder org.cocos2d.demo V reset() complete 2025-07-14 19:02:02.247 5451-5506 AudioResampler org.cocos2d.demo V resampler load 6 -> 0 MHz due to delta -6 MHz from quality 2 2025-07-14 19:02:02.252 5451-5506 AudioDecoder org.cocos2d.demo V pcm buffer size: 75232 2025-07-14 19:02:02.254 5451-5506 AudioDecoder org.cocos2d.demo D Resampling (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) wasted 8.943000ms 2025-07-14 19:02:02.254 5451-5506 AudioDecoder org.cocos2d.demo I Audio channel count is 2, no need to interleave 2025-07-14 19:02:02.254 5451-5506 AudioDecoder org.cocos2d.demo D Interleave (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) wasted 0.104000ms 2025-07-14 19:02:02.254 5451-5506 AudioPlayerProvider org.cocos2d.demo V decode succeed 2025-07-14 19:02:02.254 5451-5506 AudioPlayerProvider org.cocos2d.demo V preload (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) callback count: 1 2025-07-14 19:02:02.254 5451-5506 AudioPlayerProvider org.cocos2d.demo V FileInfo (0x763874c2e030), Set isSucceed flag: 1, path: @assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3 2025-07-14 19:02:02.254 5451-5478 AudioPlayerProvider org.cocos2d.demo V FileInfo (0x763874c2e030), Waitup preload (@assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3) ... 2025-07-14 19:02:02.254 5451-5506 AudioDecoder org.cocos2d.demo V ~AudioDecoder() 0x7638889762f0 2025-07-14 19:02:02.255 5451-5478 PcmAudioPlayer org.cocos2d.demo V PcmAudioPlayer constructor: 0x76387a63e020 2025-07-14 19:02:02.255 5451-5478 AssetFd org.cocos2d.demo V ~AssetFd: 11 2025-07-14 19:02:02.255 5451-5478 PcmAudioPlayer org.cocos2d.demo V PcmAudioPlayer (0x76387a63e020) play, url: @assets/assets/game/native/92/921f296e-e66d-4abd-89b5-5278346f0cd6.d3c80.mp3 2025-07-14 19:02:02.301 5451-5478 jswrapper org.cocos2d.demo D JS: [game-logger] 1334 2025-07-14 19:02:02.332 1452-5510 NuPlayerDriver mediaserver D notifyListener_l(0xf4419800), (211, 0, 0, 20), loop setting(0, 1) 2025-07-14 19:02:02.409 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.590 1452-5510 NuPlayerDriver mediaserver D notifyListener_l(0xf4419800), (211, 0, 0, 20), loop setting(0, 1) 2025-07-14 19:02:02.617 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.636 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 1 line 2025-07-14 19:02:02.660 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.677 5451-5507 AudioMixerController org.cocos2d.demo V Play over ... 2025-07-14 19:02:02.677 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.677 5451-5507 AudioMixerController org.cocos2d.demo V Doesn't have enough tracks: 1, 1 2025-07-14 19:02:02.680 5451-5478 AudioEngineImpl org.cocos2d.demo V Removing player id=1, state:5 2025-07-14 19:02:02.680 5451-5478 PcmAudioPlayer org.cocos2d.demo V In the destructor of PcmAudioPlayer (0x76387a63e020) 2025-07-14 19:02:02.680 5451-5478 Track org.cocos2d.demo V ~Track(): 0x7638705f4880 2025-07-14 19:02:02.690 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.774 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 7 lines 2025-07-14 19:02:02.787 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.789 1411-1411 healthd healthd I type=1400 audit(0.0:1144): avc: denied { read } for name="present" dev="sysfs" ino=6625 scontext=u:r:healthd:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1 2025-07-14 19:02:02.789 1411-1411 healthd healthd I type=1400 audit(0.0:1144): avc: denied { open } for path="/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/present" dev="sysfs" ino=6625 scontext=u:r:healthd:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1 2025-07-14 19:02:02.789 1411-1411 healthd healthd W type=1300 audit(0.0:1144): arch=c000003e syscall=257 success=yes exit=9 a0=ffffff9c a1=763917028360 a2=a0000 a3=0 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/healthd" subj=u:r:healthd:s0 key=(null) 2025-07-14 19:02:02.797 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.823 5451-5478 chatty org.cocos2d.demo I uid=10051(org.cocos2d.demo) GLThread 168 identical 2 lines 2025-07-14 19:02:02.834 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 2025-07-14 19:02:02.848 1452-5510 NuPlayerDriver mediaserver D notifyListener_l(0xf4419800), (211, 0, 0, 20), loop setting(0, 1) 2025-07-14 19:02:02.848 5451-5478 HostConnection org.cocos2d.demo D glGetError exceeded. 解决问题了吗
07-15
<think>我们分析日志,发现以下关键错误: 1. `Uncaught ReferenceError: self is not defined` 发生在加载 `gravityengine.mg.cocoscreator.min.dbb97.js` 脚本时。 2. 在初始化过程中,环境修复代码虽然已经执行,但似乎没有成功修复`self`变量。 根据之前的讨论,我们已经添加了环境修复代码来确保在原生平台(Android/iOS)上定义`self`和`global`。但是日志显示问题依然存在。 重新审视环境修复代码的触发条件: - 只在`cc.sys.isNative`为`true`时执行。 - 尝试从`project.json`中读取配置,如果读取失败则使用默认配置。 - 根据配置决定是否执行修复。 日志中有一行警告:`SDKWrapper: project.json 中不存在 serviceClassPath 字段`,这表示`project.json`被成功加载,但缺少某些字段。 然而,关键错误日志: ``` 2025-07-14 19:01:49.322 5451-5478 jswrapper org.cocos2d.demo E ScriptEngine::onGetStringFromFile stream not found, possible missing file. 2025-07-14 19:01:49.322 5451-5478 jswrapper org.cocos2d.demo E ScriptEngine::runScript script stream, buffer is empty! ``` 这表明在加载某个脚本文件时失败,可能是路径问题。 但是,紧接着的`ReferenceError: self is not defined`说明环境修复可能没有在脚本运行前完全生效。 我们之前的环境修复代码是放在入口文件的最前面,以确保在其他脚本执行前就修复环境。但是,在日志中我们看到: ``` 2025-07-14 19:01:47.522 5451-5451 SDKWrapper org.cocos2d.demo W project.json 中不存在 serviceClassPath 字段 2025-07-14 19:01:47.546 5451-5451 Cocos2dxActivity org.cocos2d.demo D onResume() 2025-07-14 19:01:47.666 5451-5478 libnb org.cocos2d.demo V enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit, trampoline_addr 0x76388e6af0c0 2025-07-14 19:01:47.666 5451-5478 main org.cocos2d.demo D cocos_android_app_init ``` 然后才开始执行JavaScript环境初始化。 因此,环境修复代码在`cocos_android_app_init`之前已经执行,理论上应该已经修复了环境。 但是,为什么还会出现`self is not defined`呢? 可能的原因: 1. 环境修复代码执行失败(例如,配置加载失败,或者路径解析失败,导致没有执行修复)。 2. 环境修复代码执行后,在JavaScript引擎初始化过程中,`self`被覆盖或清除。 我们检查环境修复代码中的关键步骤: - 我们设置了`self = globalObj`和`global = globalObj`。 - 但是,如果`globalObj`本身不正确,或者JavaScript引擎初始化过程中重新定义了全局对象,那么修复可能被覆盖。 另外,在环境修复代码之后,入口文件还有一行: ```javascript if (typeof self === 'undefined') { self = globalThis || window || {}; } ``` 这行代码是为了在非原生平台(如Web)上确保`self`存在。但在原生平台上,我们已经修复了,所以这行代码不会执行。 然而,在日志中,我们看到在`cocos_android_app_init`之后,才开始加载JavaScript脚本。因此,环境修复代码应该已经生效。 但是,错误仍然发生,我们需要进一步验证。 在日志中,我们注意到: ``` 2025-07-14 19:01:47.780 5451-5488 jswrapper org.cocos2d.demo D Debugger listening..., visit [ devtools://devtools/bundled/js_app.html?v8only=true&ws=0.0.0.0:6086/00010002-0003-4004-8005-000600070008 ] in chrome browser to debug! ``` 然后,在加载`gravityengine`脚本时出现了`self`未定义的错误。 因此,问题可能在于:环境修复代码确实执行了,但是`self`变量在JavaScript引擎的某个上下文中没有被正确设置。 在Cocos Creator的JSB环境中,JavaScript引擎是V8。在V8中,全局对象是`global`,而`self`通常是Web环境中的全局对象别名。在JSB环境中,我们期望将`self`设置为与`global`相同的对象。 但是,有可能在脚本执行之前,V8引擎的全局对象中并没有`self`属性,因此我们需要确保在全局对象上定义`self`。 修改环境修复代码:不再使用`self = globalObj`,而是使用`global.self = globalObj`,因为直接赋值`self`可能只是在当前作用域创建了一个变量,而不是在全局对象上。 但是,在入口文件中,我们处于全局作用域,所以`self = globalObj`应该是在全局对象上设置。不过,为了确保万无一失,我们可以同时使用两种方式。 我们修改环境修复代码: ```javascript // 修复全局引用 if (typeof self === 'undefined') { self = globalObj; } if (typeof global === 'undefined') { global = globalObj; } // 同时,在全局对象上设置self属性 if (globalObj && typeof globalObj.self === 'undefined') { globalObj.self = globalObj; } ``` 这样,无论是通过变量`self`还是通过`global.self`,都可以访问到全局对象。 另外,我们还需要确保环境修复代码在加载任何脚本之前执行。根据日志,环境修复代码是在`cocos_android_app_init`之前执行的,所以应该没问题。 但是,为了验证,我们在环境修复代码后立即添加日志: ```javascript console.log('Environment fixed: self is defined?', typeof self !== 'undefined'); console.log('self === global?', self === global); console.log('global.self === global?', global.self === global); ``` 在日志中查看这些输出。 另外,我们注意到错误发生在`gravityengine.mg.cocoscreator.min.dbb97.js`的第2行。这个脚本可能是第三方库,它可能期望在Web环境中运行,所以使用了`self`。 因此,我们必须确保在运行这个脚本之前,`self`已经被正确定义为全局对象。 考虑到以上,我们修改环境修复代码,并确保在全局对象上设置了`self`属性。 完整的环境修复代码(修改后): ```javascript (function() { // 只在原生平台执行修复 if (cc.sys.isNative) { try { // 尝试获取全局对象 const globalObj = (() => { if (typeof cc !== 'undefined' && cc.game && cc.game.globalObject) { return cc.game.globalObject; } if (typeof global !== 'undefined') return global; if (typeof window !== 'undefined') return window; return this || {}; })(); // 修复 self 引用 if (typeof self === 'undefined') { self = globalObj; } // 修复 global 引用 if (typeof global === 'undefined') { global = globalObj; } // 确保全局对象上有self属性 if (globalObj && typeof globalObj.self === 'undefined') { globalObj.self = globalObj; } console.log('Global environment fixed for', cc.sys.os); console.log('self is defined:', typeof self !== 'undefined'); console.log('global.self is defined:', global.self !== undefined); console.log('self === global:', self === global); console.log('global.self === global:', global.self === global); } catch (e) { console.error('Environment fix failed:', e); } } })(); ``` 然后,在入口文件中,确保这段代码在最前面执行。 另外,我们注意到在环境修复代码之后,还有一行: ```javascript if (typeof self === 'undefined') { self = globalThis || window || {}; } ``` 我们可以保留它,作为非原生平台的兜底。 但是,为了确保在原生平台上不再重复执行,我们可以将其放在环境修复代码之后,并只在非原生平台执行: ```javascript if (!cc.sys.isNative && typeof self === 'undefined') { self = globalThis || window || {}; } ``` 这样,我们就不会在原生平台上重复设置。 最后,我们还需要确保`project.json`被正确加载,因为我们的环境修复代码中有一个版本是从配置中读取路径的。如果配置加载失败,我们使用默认方式。 但是,根据日志,`project.json`被成功加载(尽管缺少某些字段),所以配置加载部分应该没有问题。 如果问题仍然存在,我们可以尝试在更早的时机修复环境,例如在Cocos2dxActivity的onCreate方法中(Java层)设置全局对象。但是,这需要修改C++或Java代码,超出了JavaScript的范围。 因此,我们首先尝试在JavaScript层彻底修复。 重新构建并测试,观察日志中是否有我们添加的验证日志,以及`self`是否被正确定义。 如果问题解决,那么就可以;如果仍然存在问题,则需要进一步分析。 由于日志中已经出现了环境修复代码中的日志(`Global environment fixed for android`),所以我们可以确认修复代码已经执行。但是,我们添加的详细日志将帮助我们确认修复是否成功。 如果添加日志后,日志输出显示`self`已经定义,但错误仍然发生,则可能是脚本在另一个作用域中执行(例如被包裹在函数中),导致访问的`self`不是全局的。但是,这不太可能,因为模块系统通常是在全局作用域中执行脚本。 因此,我们优先尝试上述修改。 修改后的环境修复代码(完整版,带日志)如下: ```javascript // ========== 环境修复代码 ========== (function() { console.log('Start environment fix for native platform...'); // 只在原生平台执行修复 if (cc.sys.isNative) { try { console.log('Applying environment fix for', cc.sys.os); // 尝试获取全局对象 const globalObj = (() => { if (typeof cc !== 'undefined' && cc.game && cc.game.globalObject) { console.log('Using cc.game.globalObject'); return cc.game.globalObject; } if (typeof global !== 'undefined') { console.log('Using global'); return global; } if (typeof window !== 'undefined') { console.log('Using window'); return window; } console.log('Using this or empty object'); return this || {}; })(); console.log('Global object:', globalObj); // 修复 self 引用 if (typeof self === 'undefined') { console.log('self is undefined, setting to globalObj'); self = globalObj; } else { console.log('self is already defined'); } // 修复 global 引用 if (typeof global === 'undefined') { console.log('global is undefined, setting to globalObj'); global = globalObj; } else { console.log('global is already defined'); } // 确保全局对象上有self属性 if (globalObj && typeof globalObj.self === 'undefined') { console.log('globalObj.self is undefined, setting to globalObj'); globalObj.self = globalObj; } else if (globalObj) { console.log('globalObj.self is already defined'); } console.log('After fix: self is defined?', typeof self !== 'undefined'); console.log('After fix: global.self is defined?', global.self !== undefined); console.log('After fix: self === global?', self === global); console.log('After fix: global.self === global?', global.self === global); } catch (e) { console.error('Environment fix failed:', e); } } else { console.log('Not native platform, skip environment fix'); } })(); // ========== 环境修复代码结束 ========== // 非原生平台的兜底 if (!cc.sys.isNative && typeof self === 'undefined') { self = globalThis || window || {}; } ``` 这样,我们可以通过日志来确认每一步的执行情况。 如果日志显示`self`和`global.self`都已经正确设置,但问题仍然存在,那么可能需要检查第三方库`gravityengine`的代码,看它是否在局部作用域中使用了`self`(例如在严格模式下,未声明的变量会导致错误)。不过,这种情况较少见。 综上所述,我们通过修改环境修复代码,增加日志,并确保在全局对象上设置`self`属性,来尝试解决`self is not defined`的问题。 请重新构建项目并运行,观察日志输出,特别是环境修复部分的日志,以及是否还有`self is not defined`的错误。</think>根据日志分析,环境修复问题尚未完全解决。主要问题出现在 JavaScript 环境中,`self` 变量未定义导致脚本执行失败: ### 关键问题分析 1. **`self` 未定义错误**: ``` Uncaught ReferenceError: self is not defined location: src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.dbb97.js:0:0 ``` 这表明在加载 `gravityengine` SDK 时,全局对象 `self` 未定义。 2. **环境修复未生效**: - 虽然我们添加了环境修复代码,但从日志看 `self = globalObj` 的修复似乎未正确应用 - 原生平台(Android)上全局对象未正确设置 3. **文件加载问题**: ``` ScriptEngine::onGetStringFromFile stream not found, possible missing file ``` 这可能与资源路径或热更新机制有关 ### 完整解决方案 #### 1. 增强环境修复代码 ```javascript // ====== 改进的环境修复代码 ====== (function() { // 1. 检测是否在原生平台 if (cc.sys.isNative) { try { console.log('Applying environment fix for', cc.sys.os); // 2. 获取全局对象的更可靠方法 const getGlobalObject = () => { // 尝试 Cocos Creator 的全局对象 if (typeof cc !== 'undefined' && cc.game && cc.game.globalObject) { return cc.game.globalObject; } // Node.js 环境 if (typeof global !== 'undefined') return global; // 浏览器环境 if (typeof window !== 'undefined') return window; // Web Worker 环境 if (typeof self !== 'undefined') return self; // 终极回退 return Function('return this')() || {}; }; const globalObj = getGlobalObject(); // 3. 修复关键全局变量 if (typeof global === 'undefined') { global = globalObj; console.log('Fixed global'); } if (typeof self === 'undefined') { self = globalObj; console.log('Fixed self'); } // 4. 确保全局对象链完整 if (typeof globalThis === 'undefined') { globalThis = globalObj; } // 5. 验证修复结果 console.log('Environment verification:'); console.log('typeof global:', typeof global); console.log('typeof self:', typeof self); console.log('self === global:', self === global); // 6. 特殊修复:确保全局对象上有 self 属性 if (globalObj && typeof globalObj.self === 'undefined') { Object.defineProperty(globalObj, 'self', { value: globalObj, writable: false, configurable: false, enumerable: false }); console.log('Added self to global object'); } } catch (e) { console.error('Environment fix failed:', e); } } else { console.log('Skipping environment fix for non-native platform'); } })(); // ====== 环境修复结束 ====== // 兼容 JSB 环境:确保 self 存在 if (typeof self === 'undefined') { self = globalThis || global || window || {}; console.warn('Fallback self initialization'); } ``` #### 2. 资源加载路径修复 ```javascript // 在游戏初始化代码中添加资源路径验证 cc.assetManager.loadScript('src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.js', (err) => { if (err) { console.error('Failed to load gravityengine SDK:', err); // 尝试备用路径 const altPath = 'assets/_plugs/lib/gravityengine.mg.cocoscreator.min.js'; console.log('Trying alternative path:', altPath); cc.assetManager.loadScript(altPath, (altErr) => { if (altErr) { console.error('Fallback load failed:', altErr); } else { console.log('Successfully loaded from fallback path'); } }); } else { console.log('GravityEngine SDK loaded successfully'); } }); ``` #### 3. 入口文件验证 在 `AppActivity.java` 中添加原生层验证: ```java // Android 原生代码 public class AppActivity extends Cocos2dxActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 验证 JavaScript 环境 runOnGLThread(() -> { String jsCode = "console.log('[Native] Environment check:', " + "typeof global, typeof self, " + "self === global, " + "self === cc.game.globalObject);"; getCocos2dxGLSurfaceView().evalString(jsCode); }); } } ``` ### 问题诊断与解决步骤 1. **环境修复未生效的原因**: - 修复代码可能执行时机太晚(在 SDK 加载之后) - Cocos JSB 环境可能有特殊的上下文隔离 - 某些平台(如 Android 8.0+)加强了全局对象保护 2. **解决方案验证**: 添加以下验证代码到入口脚本: ```javascript // 在环境修复后立即验证 setTimeout(() => { console.log('Environment verification after fix:'); console.log('self defined:', typeof self !== 'undefined'); console.log('global defined:', typeof global !== 'undefined'); console.log('self === global:', self === global); console.log('globalThis === self:', globalThis === self); // 尝试访问典型全局属性 try { console.log('self.setTimeout test:', typeof self.setTimeout); } catch (e) { console.error('Global access failed:', e); } }, 100); ``` ### 构建和测试建议 1. **日志过滤命令**: ```bash adb logcat | grep -E "Environment|Global|self|gravityengine" ``` 2. **关键验证点**: - 查找 `Applying environment fix for android` 日志 - 检查 `Environment verification after fix` 结果 - 确认 `GravityEngine SDK loaded successfully` 出现 3. **备选方案**: 如果问题仍然存在,在 SDK 加载前添加直接修复: ```javascript // 在 gravityengine SDK 加载前强制修复 window.self = window.self || globalThis || global || window || {}; ``` ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值