অ্যান্ড্রয়েড ডিবাগ ব্রিজ ( adb
) একটি বহুমুখী কমান্ড-লাইন টুল যা আপনাকে একটি ডিভাইসের সাথে যোগাযোগ করতে দেয়। adb
কমান্ড বিভিন্ন ধরনের ডিভাইস অ্যাকশনের সুবিধা দেয়, যেমন অ্যাপ ইনস্টল করা এবং ডিবাগ করা। adb
একটি ইউনিক্স শেল অ্যাক্সেস প্রদান করে যা আপনি একটি ডিভাইসে বিভিন্ন কমান্ড চালানোর জন্য ব্যবহার করতে পারেন। এটি একটি ক্লায়েন্ট-সার্ভার প্রোগ্রাম যা তিনটি উপাদান অন্তর্ভুক্ত করে:
- একটি ক্লায়েন্ট , যা কমান্ড পাঠায়। ক্লায়েন্ট আপনার ডেভেলপমেন্ট মেশিনে চলে। আপনি একটি
adb
কমান্ড জারি করে একটি কমান্ড-লাইন টার্মিনাল থেকে একটি ক্লায়েন্টকে আহ্বান করতে পারেন। - একটি ডেমন (adbd) , যা একটি ডিভাইসে কমান্ড চালায়। ডেমন প্রতিটি ডিভাইসে একটি পটভূমি প্রক্রিয়া হিসাবে চলে।
- একটি সার্ভার , যা ক্লায়েন্ট এবং ডেমনের মধ্যে যোগাযোগ পরিচালনা করে। সার্ভারটি আপনার ডেভেলপমেন্ট মেশিনে একটি ব্যাকগ্রাউন্ড প্রক্রিয়া হিসাবে চলে।
adb
অ্যান্ড্রয়েড SDK প্ল্যাটফর্ম টুলস প্যাকেজে অন্তর্ভুক্ত। SDK ম্যানেজার দিয়ে এই প্যাকেজটি ডাউনলোড করুন, যা এটিকে android_sdk /platform-tools/
এ ইনস্টল করে। আপনি যদি স্বতন্ত্র অ্যান্ড্রয়েড SDK প্ল্যাটফর্ম টুলস প্যাকেজ চান তবে এটি এখানে ডাউনলোড করুন ।
adb
মাধ্যমে ব্যবহারের জন্য একটি ডিভাইস সংযুক্ত করার তথ্যের জন্য, সাধারণ সমস্যাগুলির সমাধানের জন্য সংযোগ সহকারীকে কীভাবে ব্যবহার করতে হয়, একটি হার্ডওয়্যার ডিভাইসে অ্যাপগুলি চালান দেখুন।
কিভাবে adb কাজ করে
আপনি যখন একটি adb
ক্লায়েন্ট শুরু করেন, ক্লায়েন্ট প্রথমে পরীক্ষা করে যে একটি adb
সার্ভার প্রক্রিয়া ইতিমধ্যেই চলছে কিনা। যদি না থাকে তবে এটি সার্ভার প্রক্রিয়া শুরু করে। যখন সার্ভার শুরু হয়, তখন এটি স্থানীয় TCP পোর্ট 5037 এর সাথে আবদ্ধ হয় এবং adb
ক্লায়েন্টদের থেকে পাঠানো কমান্ড শোনে।
দ্রষ্টব্য: সমস্ত adb
ক্লায়েন্ট adb
সার্ভারের সাথে যোগাযোগ করতে পোর্ট 5037 ব্যবহার করে।
সার্ভার তারপর সমস্ত চলমান ডিভাইসের সাথে সংযোগ স্থাপন করে। এটি 5555 থেকে 5585 রেঞ্জের মধ্যে বিজোড়-সংখ্যাযুক্ত পোর্ট স্ক্যান করে এমুলেটরগুলি সনাক্ত করে, যা প্রথম 16টি এমুলেটর দ্বারা ব্যবহৃত পরিসর। যেখানে সার্ভার একটি adb
ডেমন (adbd) খুঁজে পায়, এটি সেই পোর্টের সাথে একটি সংযোগ স্থাপন করে।
প্রতিটি এমুলেটর একজোড়া ক্রমিক পোর্ট ব্যবহার করে — কনসোল সংযোগের জন্য একটি জোড়-সংখ্যাযুক্ত পোর্ট এবং adb
সংযোগের জন্য একটি বিজোড়-সংখ্যাযুক্ত পোর্ট। যেমন:
এমুলেটর 1, কনসোল: 5554
এমুলেটর 1, adb
: 5555
এমুলেটর 2, কনসোল: 5556
এমুলেটর 2, adb
: 5557
এবং তাই
যেমন দেখানো হয়েছে, পোর্ট 5555-এ adb
এর সাথে সংযুক্ত এমুলেটরটি সেই এমুলেটরের মতো যার কনসোল পোর্ট 5554-এ শোনে।
একবার সার্ভার সমস্ত ডিভাইসে সংযোগ স্থাপন করে, আপনি সেই ডিভাইসগুলি অ্যাক্সেস করতে adb
কমান্ড ব্যবহার করতে পারেন। যেহেতু সার্ভারটি ডিভাইসের সাথে সংযোগ পরিচালনা করে এবং একাধিক adb
ক্লায়েন্ট থেকে কমান্ড পরিচালনা করে, আপনি যেকোনো ক্লায়েন্ট বা স্ক্রিপ্ট থেকে যেকোনো ডিভাইস নিয়ন্ত্রণ করতে পারেন।
আপনার ডিভাইসে অ্যাডবি ডিবাগিং সক্ষম করুন
USB-এর মাধ্যমে সংযুক্ত একটি ডিভাইসের সাথে adb ব্যবহার করতে, আপনাকে অবশ্যই বিকাশকারী বিকল্পগুলির অধীনে ডিভাইস সিস্টেম সেটিংসে USB ডিবাগিং সক্ষম করতে হবে৷ Android 4.2 (API স্তর 17) এবং উচ্চতর, বিকাশকারী বিকল্পগুলির স্ক্রীনটি ডিফল্টরূপে লুকানো থাকে৷ এটি দৃশ্যমান করতে, বিকাশকারী বিকল্পগুলি সক্ষম করুন৷
আপনি এখন USB দিয়ে আপনার ডিভাইস সংযোগ করতে পারেন। আপনি android_sdk /platform-tools/
ডিরেক্টরি থেকে adb devices
সম্পাদন করে আপনার ডিভাইসটি সংযুক্ত কিনা তা যাচাই করতে পারেন। সংযুক্ত থাকলে, আপনি "ডিভাইস" হিসাবে তালিকাভুক্ত ডিভাইসের নাম দেখতে পাবেন।
দ্রষ্টব্য: আপনি যখন Android 4.2.2 (API স্তর 17) বা উচ্চতর চলমান একটি ডিভাইস সংযুক্ত করেন, তখন সিস্টেমটি একটি ডায়ালগ দেখায় যা জিজ্ঞাসা করে যে একটি RSA কী গ্রহণ করবেন কিনা যা এই কম্পিউটারের মাধ্যমে ডিবাগ করার অনুমতি দেয়৷ এই নিরাপত্তা ব্যবস্থা ব্যবহারকারীর ডিভাইসগুলিকে রক্ষা করে কারণ এটি নিশ্চিত করে যে USB ডিবাগিং এবং অন্যান্য adb কমান্ডগুলি কার্যকর করা যাবে না যদি না আপনি ডিভাইসটি আনলক করতে এবং ডায়ালগটি স্বীকার করতে সক্ষম হন।
USB এর মাধ্যমে একটি ডিভাইসের সাথে সংযোগ করার বিষয়ে আরও তথ্যের জন্য, একটি হার্ডওয়্যার ডিভাইসে অ্যাপ্লিকেশন চালান পড়ুন।
Wi-Fi এর মাধ্যমে একটি ডিভাইসের সাথে সংযোগ করুন৷
দ্রষ্টব্য: নীচের নির্দেশাবলী Android 11 (API স্তর 30) চালিত Wear ডিভাইসগুলিতে প্রযোজ্য নয়। আরও তথ্যের জন্য একটি Wear OS অ্যাপ ডিবাগ করার নির্দেশিকা দেখুন।
অ্যান্ড্রয়েড 11 (এপিআই লেভেল 30) এবং উচ্চতর সমর্থন অ্যান্ড্রয়েড ডিবাগ ব্রিজ (এডিবি) ব্যবহার করে আপনার ওয়ার্কস্টেশন থেকে ওয়্যারলেসভাবে আপনার অ্যাপ স্থাপন এবং ডিবাগ করা। উদাহরণস্বরূপ, আপনি USB এর মাধ্যমে আপনার ডিভাইসটিকে শারীরিকভাবে সংযুক্ত করার প্রয়োজন ছাড়াই একাধিক দূরবর্তী ডিভাইসে আপনার ডিবাগযোগ্য অ্যাপ স্থাপন করতে পারেন। এটি ড্রাইভার ইনস্টলেশনের মতো সাধারণ USB সংযোগ সমস্যাগুলি মোকাবেলা করার প্রয়োজনীয়তা দূর করে।
আপনি ওয়্যারলেস ডিবাগিং ব্যবহার শুরু করার আগে, নিম্নলিখিতগুলি করুন:
আপনার ওয়ার্কস্টেশন এবং ডিভাইস একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত আছে তা নিশ্চিত করুন।
নিশ্চিত করুন যে আপনার ডিভাইসটি Android 11 (API লেভেল 30) বা ফোনের জন্য উচ্চতর বা Android 13 (API লেভেল 33) বা TV এবং WearOS-এর জন্য উচ্চতর চালাচ্ছে। আরও তথ্যের জন্য, আপনার অ্যান্ড্রয়েড সংস্করণ দেখুন এবং আপডেট করুন ।
যদি IDE ব্যবহার করেন, তাহলে নিশ্চিত করুন যে আপনার Android Studio এর সর্বশেষ সংস্করণ ইনস্টল করা আছে। আপনি এখানে এটি ডাউনলোড করতে পারেন.
আপনার ওয়ার্কস্টেশনে, SDK প্ল্যাটফর্ম টুলের সর্বশেষ সংস্করণে আপডেট করুন।
ওয়্যারলেস ডিবাগিং ব্যবহার করতে, আপনাকে অবশ্যই একটি QR কোড বা একটি পেয়ারিং কোড ব্যবহার করে আপনার ডিভাইসটিকে আপনার ওয়ার্কস্টেশনের সাথে যুক্ত করতে হবে৷ আপনার ওয়ার্কস্টেশন এবং ডিভাইস অবশ্যই একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত থাকতে হবে। আপনার ডিভাইসের সাথে সংযোগ করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
আপনার ডিভাইসে বিকাশকারী বিকল্পগুলি সক্ষম করুন ৷
অ্যান্ড্রয়েড স্টুডিও খুলুন এবং রান কনফিগারেশন মেনু থেকে Wi-Fi ব্যবহার করে ডিভাইস জোড়া নির্বাচন করুন।
চিত্র 1. কনফিগারেশন মেনু চালান।Wi-Fi উইন্ডোতে জোড়া ডিভাইসগুলি পপ আপ হয়, যেমন চিত্র 2 এ দেখানো হয়েছে।
চিত্র 2. QR কোড বা পেয়ারিং কোড ব্যবহার করে ডিভাইস জোড়ার জন্য পপআপ উইন্ডো।আপনার ডিভাইসে, ওয়্যারলেস ডিবাগিং আলতো চাপুন এবং আপনার ডিভাইস যুক্ত করুন:
চিত্র 3. Google Pixel ফোনে ওয়্যারলেস ডিবাগিং সেটিংসের স্ক্রিনশট।আপনার ডিভাইসটিকে একটি QR কোডের সাথে পেয়ার করতে, QR কোডের সাথে পেয়ার ডিভাইস নির্বাচন করুন এবং চিত্র 2-এ দেখানো Wi-Fi পপআপের মাধ্যমে পেয়ার ডিভাইসগুলি থেকে প্রাপ্ত QR কোডটি স্ক্যান করুন৷
পেয়ারিং কোডের সাথে আপনার ডিভাইস পেয়ার করতে, Wi-Fi পপআপের মাধ্যমে পেয়ার ডিভাইস থেকে পেয়ারিং কোডের সাথে পেয়ার ডিভাইস নির্বাচন করুন। আপনার ডিভাইসে, পেয়ারিং কোড ব্যবহার করে পেয়ার নির্বাচন করুন এবং প্রদত্ত ছয়-সংখ্যার কোডটি নোট করুন। একবার আপনার ডিভাইসটি Wi-Fi উইন্ডোতে পেয়ার ডিভাইসে প্রদর্শিত হলে, আপনি পেয়ার নির্বাচন করতে পারেন এবং আপনার ডিভাইসে দেখানো ছয়-সংখ্যার কোডটি প্রবেশ করতে পারেন।
চিত্র 4. ছয় সংখ্যার কোড এন্ট্রির উদাহরণ।
আপনার ডিভাইস যুক্ত হওয়ার পরে, আপনি আপনার ডিভাইসে আপনার অ্যাপ স্থাপন করার চেষ্টা করতে পারেন।
একটি ভিন্ন ডিভাইস যুক্ত করতে বা আপনার ওয়ার্কস্টেশনে বর্তমান ডিভাইসটি ভুলে যেতে, আপনার ডিভাইসে ওয়্যারলেস ডিবাগিং এ নেভিগেট করুন। পেয়ারড ডিভাইসের অধীনে আপনার ওয়ার্কস্টেশনের নাম আলতো চাপুন এবং ভুলে যান নির্বাচন করুন।
আপনি যদি ওয়্যারলেস ডিবাগিং দ্রুত চালু এবং বন্ধ করতে চান, আপনি ওয়্যারলেস ডিবাগিংয়ের জন্য দ্রুত সেটিংস ডেভেলপার টাইলস ব্যবহার করতে পারেন, যা বিকাশকারী বিকল্প > দ্রুত সেটিংস বিকাশকারী টাইলস- এ পাওয়া যায়।
চিত্র 5. দ্রুত সেটিংস বিকাশকারী টাইলস সেটিং আপনাকে দ্রুত ওয়্যারলেস ডিবাগিং চালু এবং বন্ধ করতে দেয়।
কমান্ড লাইন ব্যবহার করে Wi-Fi সংযোগ
বিকল্পভাবে, অ্যান্ড্রয়েড স্টুডিও ছাড়া কমান্ড লাইন ব্যবহার করে আপনার ডিভাইসে সংযোগ করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
আপনার ডিভাইসে বিকাশকারী বিকল্পগুলি সক্ষম করুন, যেমনটি আগে বর্ণিত হয়েছে৷
আপনার ডিভাইসে ওয়্যারলেস ডিবাগিং সক্ষম করুন, যেমনটি আগে বর্ণিত হয়েছে।
আপনার ওয়ার্কস্টেশনে, একটি টার্মিনাল উইন্ডো খুলুন এবং
android_sdk/platform-tools
এ নেভিগেট করুন।পেয়ারিং কোডের সাথে পেয়ার ডিভাইস নির্বাচন করে আপনার IP ঠিকানা, পোর্ট নম্বর এবং পেয়ারিং কোড খুঁজুন। ডিভাইসে প্রদর্শিত IP ঠিকানা, পোর্ট নম্বর এবং পেয়ারিং কোড নোট করুন।
আপনার ওয়ার্কস্টেশনের টার্মিনালে,
adb pair ipaddr:port
চালান। উপরে থেকে আইপি ঠিকানা এবং পোর্ট নম্বর ব্যবহার করুন।অনুরোধ করা হলে, পেয়ারিং কোড লিখুন, যেমন নীচে দেখানো হয়েছে।
চিত্র 6. একটি বার্তা নির্দেশ করে যে আপনার ডিভাইসটি সফলভাবে জোড়া হয়েছে৷
বেতার সংযোগ সমস্যা সমাধান করুন
আপনার ডিভাইসে ওয়্যারলেসভাবে সংযোগ করতে সমস্যা হলে, সমস্যা সমাধানের জন্য নিম্নলিখিত সমস্যা সমাধানের পদক্ষেপগুলি চেষ্টা করুন।
আপনার ওয়ার্কস্টেশন এবং ডিভাইস পূর্বশর্তগুলি পূরণ করে কিনা তা পরীক্ষা করুন
ওয়ার্কস্টেশন এবং ডিভাইস এই বিভাগের শুরুতে তালিকাভুক্ত পূর্বশর্তগুলি পূরণ করে কিনা তা পরীক্ষা করুন৷
অন্যান্য পরিচিত সমস্যা জন্য পরীক্ষা করুন
ওয়্যারলেস ডিবাগিং (এডিবি বা অ্যান্ড্রয়েড স্টুডিও সহ) এবং কীভাবে সেগুলি সমাধান করা যায় তার বর্তমান পরিচিত সমস্যাগুলির একটি তালিকা নীচে দেওয়া হল:
Wi-Fi সংযোগ হচ্ছে না : নিরাপদ Wi-Fi নেটওয়ার্ক, যেমন কর্পোরেট ওয়াই-ফাই নেটওয়ার্ক, p2p সংযোগগুলি ব্লক করতে পারে এবং আপনাকে Wi-Fi এর মাধ্যমে সংযোগ করতে দেয় না৷ একটি কেবল বা অন্য (নন-কর্প) Wi-Fi নেটওয়ার্কের সাথে সংযোগ করার চেষ্টা করুন৷
adb connect ip : port
ওভার টিসিপি/আইপি (প্রাথমিক ইউএসবি কানেকশন অনুসরণ করে) আরেকটি বিকল্প, যদি নন-কর্প নেটওয়ার্ক অবলম্বন করা একটি বিকল্প।adb
ওভার Wi-Fi কখনও কখনও স্বয়ংক্রিয়ভাবে বন্ধ হয়ে যায় : ডিভাইসটি Wi-Fi নেটওয়ার্ক সুইচ করলে বা নেটওয়ার্ক থেকে সংযোগ বিচ্ছিন্ন হলে এটি ঘটতে পারে৷ সমাধান করতে, নেটওয়ার্কে পুনরায় সংযোগ করুন৷সফলভাবে জোড়া লাগানোর পর ডিভাইস সংযোগ হচ্ছে না :
adb
জোড়া ডিভাইস আবিষ্কার করতে এবং স্বয়ংক্রিয়ভাবে সংযোগ করতে mDNS-এর উপর নির্ভর করে। যদি আপনার নেটওয়ার্ক বা ডিভাইস কনফিগারেশন mDNS সমর্থন না করে বা এটি নিষ্ক্রিয় করে থাকে, তাহলে আপনাকেadb connect ip : port
ব্যবহার করে ডিভাইসের সাথে ম্যানুয়ালি সংযোগ করতে হবে।
একটি প্রাথমিক USB সংযোগের পরে একটি ডিভাইসের সাথে ওয়্যারলেসভাবে সংযোগ করুন (কেবলমাত্র Android 10 এবং তার নিচের সংস্করণগুলিতে উপলব্ধ)
দ্রষ্টব্য: এই ওয়ার্কফ্লোটি Android 11 (এবং উচ্চতর) এর ক্ষেত্রেও প্রযোজ্য, সতর্কতা হল যে এটিতে একটি *প্রাথমিক* সংযোগও রয়েছে।
দ্রষ্টব্য: নিম্নলিখিত নির্দেশাবলী Android 10 (API স্তর 29) বা তার নিচের চলমান Wear ডিভাইসগুলিতে প্রযোজ্য নয়৷ আরও তথ্যের জন্য একটি Wear OS অ্যাপ ডিবাগ করার নির্দেশিকা দেখুন।
adb
সাধারণত USB এর মাধ্যমে ডিভাইসের সাথে যোগাযোগ করে, তবে আপনি Wi-Fi এর মাধ্যমে adb
ব্যবহার করতে পারেন। অ্যান্ড্রয়েড 10 (এপিআই লেভেল 29) বা তার নিচে চলমান একটি ডিভাইস সংযোগ করতে, ইউএসবি-তে এই প্রাথমিক পদক্ষেপগুলি অনুসরণ করুন:
- আপনার অ্যান্ড্রয়েড ডিভাইস এবং
adb
হোস্ট কম্পিউটারকে একটি সাধারণ ওয়াই-ফাই নেটওয়ার্কে সংযুক্ত করুন৷ - একটি USB তারের সাহায্যে হোস্ট কম্পিউটারের সাথে ডিভাইসটিকে সংযুক্ত করুন৷
- পোর্ট 5555 এ একটি TCP/IP সংযোগের জন্য শোনার জন্য লক্ষ্য ডিভাইস সেট করুন:
adb tcpip 5555
- লক্ষ্য ডিভাইস থেকে USB তারের সংযোগ বিচ্ছিন্ন করুন.
- অ্যান্ড্রয়েড ডিভাইসের আইপি ঠিকানা খুঁজুন। উদাহরণস্বরূপ, একটি Nexus ডিভাইসে, আপনি সেটিংস > ট্যাবলেট সম্পর্কে (বা ফোন সম্পর্কে ) > স্থিতি > IP ঠিকানাতে IP ঠিকানা খুঁজে পেতে পারেন।
- আইপি ঠিকানা দ্বারা ডিভাইসের সাথে সংযোগ করুন:
adb connect device_ip_address:5555
- নিশ্চিত করুন যে আপনার হোস্ট কম্পিউটার লক্ষ্য ডিভাইসের সাথে সংযুক্ত আছে:
$ adb devices List of devices attached device_ip_address:5555 device
দ্রষ্টব্য: সতর্ক থাকুন যে সমস্ত অ্যাক্সেস পয়েন্ট উপযুক্ত নয়। আপনাকে একটি অ্যাক্সেস পয়েন্ট ব্যবহার করতে হতে পারে যার ফায়ারওয়াল adb
সমর্থন করার জন্য সঠিকভাবে কনফিগার করা হয়েছে।
আপনার ডিভাইস এখন adb
এর সাথে সংযুক্ত।
আপনার ডিভাইসে adb
সংযোগ হারিয়ে গেলে:
- নিশ্চিত করুন যে আপনার হোস্ট এখনও আপনার Android ডিভাইসের মতো একই Wi-Fi নেটওয়ার্কের সাথে সংযুক্ত রয়েছে৷
-
adb connect
ধাপটি আবার সম্পাদন করে পুনরায় সংযোগ করুন। - যদি এটি কাজ না করে, আপনার
adb
হোস্ট রিসেট করুন:adb kill-server
তারপর আবার শুরু থেকে শুরু করুন।
ডিভাইসের জন্য ক্যোয়ারী
adb
কমান্ড ইস্যু করার আগে, adb
সার্ভারের সাথে কোন ডিভাইসের দৃষ্টান্ত সংযুক্ত আছে তা জেনে নেওয়া সহায়ক। devices
কমান্ড ব্যবহার করে সংযুক্ত ডিভাইসের একটি তালিকা তৈরি করুন:
adb devices -l
প্রতিক্রিয়া হিসাবে, adb
প্রতিটি ডিভাইসের জন্য এই স্থিতি তথ্য মুদ্রণ করে:
- সিরিয়াল নম্বর:
adb
ডিভাইসটিকে তার পোর্ট নম্বর দ্বারা অনন্যভাবে সনাক্ত করার জন্য একটি স্ট্রিং তৈরি করে। এখানে একটি উদাহরণ সিরিয়াল নম্বর:emulator-5554
- অবস্থা: ডিভাইসের সংযোগের অবস্থা নিম্নলিখিতগুলির মধ্যে একটি হতে পারে:
-
offline
: ডিভাইসটিadb
এর সাথে সংযুক্ত নয় বা সাড়া দিচ্ছে না। -
device
: ডিভাইসটিadb
সার্ভারের সাথে সংযুক্ত। মনে রাখবেন যে এই অবস্থাটি বোঝায় না যে অ্যান্ড্রয়েড সিস্টেমটি সম্পূর্ণরূপে বুট হয়েছে এবং চালু আছে, কারণ সিস্টেমটি বুট করার সময় ডিভাইসটিadb
এর সাথে সংযোগ করে। বুট-আপের পরে, এটি একটি ডিভাইসের স্বাভাবিক অপারেশনাল অবস্থা। -
no device
: কোনো ডিভাইস সংযুক্ত নেই।
-
- বর্ণনা: আপনি যদি
-l
বিকল্পটি অন্তর্ভুক্ত করেন,devices
কমান্ড আপনাকে বলে যে ডিভাইসটি কী। এই তথ্যটি সহায়ক যখন আপনার একাধিক ডিভাইস সংযুক্ত থাকে যাতে আপনি তাদের আলাদা করে বলতে পারেন৷
নিম্নলিখিত উদাহরণটি devices
কমান্ড এবং এর আউটপুট দেখায়। তিনটি ডিভাইস চলছে। তালিকার প্রথম দুটি লাইন হল এমুলেটর, এবং তৃতীয় লাইন হল একটি হার্ডওয়্যার ডিভাইস যা কম্পিউটারের সাথে সংযুক্ত।
$ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo
এমুলেটর তালিকাভুক্ত নয়
adb devices
কমান্ডের একটি কর্নার-কেস কমান্ড সিকোয়েন্স রয়েছে যার কারণে এমুলেটরগুলি আপনার ডেস্কটপে দৃশ্যমান থাকা সত্ত্বেও চলমান এমুলেটরগুলি adb devices
আউটপুটে দেখা যায় না। এটি ঘটে যখন নিম্নলিখিত সমস্ত শর্ত সত্য হয়:
-
adb
সার্ভার চলছে না। - আপনি 5554 এবং 5584 এর মধ্যে বিজোড়-সংখ্যাযুক্ত পোর্ট মান সহ
-port
বা-ports
বিকল্পের সাথেemulator
কমান্ডটি ব্যবহার করেন। - আপনার বেছে নেওয়া বিজোড়-সংখ্যার পোর্টটি ব্যস্ত নয়, তাই পোর্ট সংযোগটি নির্দিষ্ট পোর্ট নম্বরে করা যেতে পারে — অথবা, যদি এটি ব্যস্ত থাকে, তাহলে এমুলেটরটি অন্য পোর্টে স্যুইচ করে যা 2-এ প্রয়োজনীয়তা পূরণ করে।
- আপনি এমুলেটর শুরু করার পরে আপনি
adb
সার্ভার শুরু করবেন।
এই পরিস্থিতি এড়াতে একটি উপায় হল এমুলেটরকে তার নিজস্ব পোর্ট বেছে নিতে দেওয়া এবং একবারে 16 টির বেশি এমুলেটর চালানো না। আরেকটি উপায় হল emulator
কমান্ড ব্যবহার করার আগে সর্বদা adb
সার্ভার চালু করা, যেমনটি নিম্নলিখিত উদাহরণগুলিতে ব্যাখ্যা করা হয়েছে।
উদাহরণ 1: নিম্নলিখিত কমান্ডের ক্রমানুসারে, adb devices
কমান্ড adb
সার্ভার শুরু করে, কিন্তু ডিভাইসের তালিকা প্রদর্শিত হয় না।
adb
সার্ভার বন্ধ করুন এবং দেখানো ক্রমে নিম্নলিখিত কমান্ড লিখুন। AVD নামের জন্য, আপনার সিস্টেম থেকে একটি বৈধ AVD নাম প্রদান করুন। AVD নামের একটি তালিকা পেতে, emulator -list-avds
টাইপ করুন। emulator
কমান্ডটি android_sdk /tools
ডিরেক্টরিতে রয়েছে।
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5555 $ adb devices List of devices attached * daemon not running. starting it now on port 5037 * * daemon started successfully *
উদাহরণ 2: নিম্নলিখিত কমান্ড ক্রমানুসারে, adb devices
ডিভাইসের তালিকা প্রদর্শন করে কারণ adb
সার্ভারটি প্রথমে শুরু হয়েছিল।
adb devices
আউটপুটে এমুলেটর দেখতে, adb
সার্ভার বন্ধ করুন এবং তারপরে emulator
কমান্ড ব্যবহার করার পরে এবং adb devices
কমান্ড ব্যবহার করার আগে এটি আবার শুরু করুন, নিম্নরূপ:
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices List of devices attached emulator-5557 device
এমুলেটর কমান্ড-লাইন বিকল্পগুলি সম্পর্কে আরও তথ্যের জন্য, কমান্ড-লাইন স্টার্টআপ বিকল্পগুলি দেখুন।
একটি নির্দিষ্ট ডিভাইসে কমান্ড পাঠান
একাধিক ডিভাইস চলমান থাকলে, adb
কমান্ড ইস্যু করার সময় আপনাকে অবশ্যই লক্ষ্য ডিভাইসটি নির্দিষ্ট করতে হবে। লক্ষ্য নির্দিষ্ট করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
- লক্ষ্যের সিরিয়াল নম্বর পেতে
devices
কমান্ড ব্যবহার করুন। - আপনার সিরিয়াল নম্বর হয়ে গেলে, সিরিয়াল নম্বর নির্দিষ্ট করতে
adb
কমান্ডের সাথে-s
বিকল্পটি ব্যবহার করুন।- আপনি যদি অনেকগুলি
adb
কমান্ড ইস্যু করতে যাচ্ছেন, তাহলে আপনি ক্রমিক নম্বর ধারণ করার জন্য$ANDROID_SERIAL
পরিবেশ পরিবর্তনশীল সেট করতে পারেন। - আপনি যদি
-s
এবং$ANDROID_SERIAL
উভয়ই ব্যবহার করেন,-s
ওভাররাইড করে$ANDROID_SERIAL
।
- আপনি যদি অনেকগুলি
নিম্নলিখিত উদাহরণে, সংযুক্ত ডিভাইসের তালিকা পাওয়া যায়, এবং তারপরে সেই ডিভাইসে helloWorld.apk
ইনস্টল করতে ডিভাইসগুলির একটির সিরিয়াল নম্বর ব্যবহার করা হয়:
$ adb devices List of devices attached emulator-5554 device emulator-5555 device 0.0.0.0:6520 device # To install on emulator-5555 $ adb -s emulator-5555 install helloWorld.apk # To install on 0.0.0.0:6520 $ adb -s 0.0.0.0:6520 install helloWorld.apk
দ্রষ্টব্য: আপনি একাধিক ডিভাইস উপলব্ধ থাকাকালীন একটি টার্গেট ডিভাইস নির্দিষ্ট না করে একটি কমান্ড ইস্যু করলে, adb
একটি ত্রুটি প্রদর্শন করে "adb: একাধিক ডিভাইস/এমুলেটর"।
আপনার যদি একাধিক ডিভাইস উপলব্ধ থাকে তবে শুধুমাত্র একটি এমুলেটর হয়, তাহলে এমুলেটরে কমান্ড পাঠাতে -e
বিকল্পটি ব্যবহার করুন। যদি একাধিক ডিভাইস থাকে কিন্তু শুধুমাত্র একটি হার্ডওয়্যার ডিভাইস সংযুক্ত থাকে, তাহলে হার্ডওয়্যার ডিভাইসে কমান্ড পাঠাতে -d
বিকল্পটি ব্যবহার করুন।
একটি অ্যাপ ইনস্টল করুন
আপনি install
কমান্ড সহ একটি এমুলেটর বা সংযুক্ত ডিভাইসে একটি APK ইনস্টল করতে adb
ব্যবহার করতে পারেন:
adb install path_to_apk
আপনি একটি পরীক্ষা APK ইনস্টল করার সময় install
কমান্ডের সাথে -t
বিকল্পটি ব্যবহার করতে হবে। আরও তথ্যের জন্য, দেখুন -t
।
একাধিক APK ইনস্টল করতে install-multiple
ব্যবহার করুন। আপনি যদি প্লে কনসোল থেকে আপনার অ্যাপের জন্য একটি নির্দিষ্ট ডিভাইসের জন্য সমস্ত APK ডাউনলোড করেন এবং এমুলেটর বা শারীরিক ডিভাইসে ইনস্টল করতে চান তবে এটি কার্যকর।
আপনি একটি এমুলেটর/ডিভাইস ইনস্ট্যান্সে ইনস্টল করতে পারেন এমন একটি APK ফাইল কীভাবে তৈরি করবেন সে সম্পর্কে আরও তথ্যের জন্য, আপনার অ্যাপ তৈরি করুন এবং চালান দেখুন।
দ্রষ্টব্য: আপনি যদি অ্যান্ড্রয়েড স্টুডিও ব্যবহার করেন, তাহলে এমুলেটর বা ডিভাইসে আপনার অ্যাপ ইনস্টল করার জন্য আপনাকে সরাসরি adb
ব্যবহার করতে হবে না। পরিবর্তে, Android স্টুডিও আপনার জন্য অ্যাপটির প্যাকেজিং এবং ইনস্টলেশন পরিচালনা করে।
পোর্ট ফরওয়ার্ডিং সেট আপ করুন
ইচ্ছামত পোর্ট ফরওয়ার্ডিং সেট আপ করতে forward
কমান্ডটি ব্যবহার করুন, যা একটি নির্দিষ্ট হোস্ট পোর্টের অনুরোধগুলিকে একটি ডিভাইসের একটি ভিন্ন পোর্টে ফরোয়ার্ড করে। নিম্নলিখিত উদাহরণটি হোস্ট পোর্ট 6100 এর ডিভাইস পোর্ট 7100 এ ফরওয়ার্ডিং সেট আপ করে:
adb forward tcp:6100 tcp:7100
নিম্নলিখিত উদাহরণটি হোস্ট পোর্ট 6100-কে স্থানীয়:logd-এ ফরওয়ার্ডিং সেট আপ করে:
adb forward tcp:6100 local:logd
আপনি ডিভাইসে একটি প্রদত্ত পোর্টে কি পাঠানো হচ্ছে তা নির্ধারণ করার চেষ্টা করলে এটি কার্যকর হতে পারে। সমস্ত প্রাপ্ত ডেটা সিস্টেম-লগিং ডেমনে লেখা হবে এবং ডিভাইস লগগুলিতে প্রদর্শিত হবে।
একটি ডিভাইস থেকে ফাইল কপি করুন
একটি ডিভাইস থেকে ফাইল কপি করতে pull
এবং push
কমান্ড ব্যবহার করুন। install
কমান্ডের বিপরীতে, যা শুধুমাত্র একটি নির্দিষ্ট স্থানে একটি APK ফাইল অনুলিপি করে, pull
এবং push
কমান্ডগুলি আপনাকে ডিভাইসের যেকোনো অবস্থানে নির্বিচারে ডিরেক্টরি এবং ফাইলগুলি অনুলিপি করতে দেয়।
ডিভাইস থেকে একটি ফাইল বা ডিরেক্টরি এবং এর সাব-ডিরেক্টরি অনুলিপি করতে, নিম্নলিখিতগুলি করুন:
adb pull remote local
ডিভাইসে একটি ফাইল বা ডিরেক্টরি এবং এর সাব-ডিরেক্টরি অনুলিপি করতে, নিম্নলিখিতগুলি করুন:
adb push local remote
আপনার ডেভেলপমেন্ট মেশিনে (স্থানীয়) এবং ডিভাইসে (দূরবর্তী) টার্গেট ফাইল/ডিরেক্টরীতে পাথ দিয়ে local
এবং remote
প্রতিস্থাপন করুন। যেমন:
adb push myfile.txt /sdcard/myfile.txt
অ্যাডবি সার্ভার বন্ধ করুন
কিছু ক্ষেত্রে, আপনাকে adb
সার্ভার প্রক্রিয়াটি বন্ধ করতে হবে এবং তারপর সমস্যাটি সমাধান করতে এটি পুনরায় চালু করতে হবে। উদাহরণস্বরূপ, যদি adb
একটি আদেশে সাড়া না দেয় তাহলে এটি হতে পারে।
adb
সার্ভার বন্ধ করতে, adb kill-server
কমান্ড ব্যবহার করুন। তারপর আপনি অন্য কোন adb
কমান্ড জারি করে সার্ভার পুনরায় চালু করতে পারেন।
adb কমান্ড ইস্যু করুন
আপনার ডেভেলপমেন্ট মেশিনে একটি কমান্ড লাইন থেকে বা নিম্নলিখিত ব্যবহার করে একটি স্ক্রিপ্ট থেকে adb
কমান্ড ইস্যু করুন:
adb [-d | -e | -s serial_number] command
শুধুমাত্র একটি এমুলেটর চলমান থাকলে বা শুধুমাত্র একটি ডিভাইস সংযুক্ত থাকলে, ডিফল্টরূপে সেই ডিভাইসে adb
কমান্ড পাঠানো হয়। যদি একাধিক এমুলেটর চলমান থাকে এবং/অথবা একাধিক ডিভাইস সংযুক্ত থাকে, তাহলে আপনাকে -d
, -e
, বা -s
বিকল্পটি ব্যবহার করতে হবে লক্ষ্য ডিভাইসটি নির্দিষ্ট করতে যেখানে কমান্ডটি নির্দেশিত হবে।
আপনি নিম্নলিখিত কমান্ড ব্যবহার করে সমস্ত সমর্থিত adb
কমান্ডের একটি বিস্তারিত তালিকা দেখতে পারেন:
adb --help
শেল কমান্ড ইস্যু করুন
আপনি adb
এর মাধ্যমে ডিভাইস কমান্ড ইস্যু করতে বা একটি ইন্টারেক্টিভ শেল শুরু করতে shell
কমান্ড ব্যবহার করতে পারেন। একটি একক কমান্ড ইস্যু করতে, এই মত shell
কমান্ড ব্যবহার করুন:
adb [-d |-e | -s serial_number] shell shell_command
একটি ডিভাইসে একটি ইন্টারেক্টিভ শেল শুরু করতে, এই মত shell
কমান্ড ব্যবহার করুন:
adb [-d | -e | -s serial_number] shell
একটি ইন্টারেক্টিভ শেল থেকে প্রস্থান করতে, Control+D
টিপুন বা exit
টাইপ করুন।
অ্যান্ড্রয়েড বেশিরভাগ সাধারণ ইউনিক্স কমান্ড-লাইন সরঞ্জাম সরবরাহ করে। উপলব্ধ সরঞ্জামগুলির একটি তালিকার জন্য, নিম্নলিখিত কমান্ডটি ব্যবহার করুন:
adb shell ls /system/bin
--help
আর্গুমেন্টের মাধ্যমে বেশিরভাগ কমান্ডের জন্য সাহায্য পাওয়া যায়। অনেক শেল কমান্ড টয়বক্স দ্বারা সরবরাহ করা হয়। toybox --help
এর মাধ্যমে সমস্ত toybox কমান্ডের জন্য প্রযোজ্য সাধারণ সাহায্য পাওয়া যায়।
অ্যান্ড্রয়েড প্ল্যাটফর্ম টুল 23 এবং উচ্চতরের সাথে, adb
ssh(1)
কমান্ডের মতো আর্গুমেন্ট পরিচালনা করে। এই পরিবর্তনটি কমান্ড ইনজেকশনের অনেক সমস্যার সমাধান করেছে এবং শেল মেটাক্যারেক্টার ধারণকারী কমান্ডগুলিকে নিরাপদে চালানো সম্ভব করে তোলে, যেমন adb install Let\'sGo.apk
। এই পরিবর্তনের অর্থ হল শেল মেটাক্যারেক্টার ধারণ করে এমন যেকোনো কমান্ডের ব্যাখ্যাও পরিবর্তিত হয়েছে।
উদাহরণস্বরূপ, adb shell setprop key ' two words '
এখন একটি ত্রুটি, কারণ উদ্ধৃতিগুলি স্থানীয় শেল দ্বারা গ্রাস করা হয় এবং ডিভাইসটি adb shell setprop key two words
দেখতে পায়। কমান্ডটি কাজ করার জন্য, দুইবার উদ্ধৃতি করুন, একবার স্থানীয় শেলের জন্য এবং একবার দূরবর্তী শেলের জন্য, যেমন আপনি ssh(1)
দিয়ে করেন। উদাহরণস্বরূপ, adb shell setprop key "' two words '"
কাজ করে কারণ স্থানীয় শেলটি উদ্ধৃতির বাইরের স্তরটি নেয় এবং ডিভাইসটি এখনও উদ্ধৃতির ভিতরের স্তরটি দেখতে পায়: setprop key 'two words'
। পালানোও একটি বিকল্প, তবে দুবার উদ্ধৃত করা সাধারণত সহজ।
এছাড়াও Logcat কমান্ড-লাইন টুল দেখুন, যা সিস্টেম লগ নিরীক্ষণের জন্য দরকারী।
অ্যাক্টিভিটি ম্যানেজারকে কল করুন
একটি adb
শেলের মধ্যে, আপনি বিভিন্ন সিস্টেম ক্রিয়া সম্পাদনের জন্য কার্যকলাপ পরিচালক ( am
) টুলের সাথে কমান্ড ইস্যু করতে পারেন, যেমন একটি কার্যকলাপ শুরু করা, একটি প্রক্রিয়া জোর করে বন্ধ করা, একটি উদ্দেশ্য সম্প্রচার করা, ডিভাইসের স্ক্রীন বৈশিষ্ট্যগুলি পরিবর্তন করা এবং আরও অনেক কিছু।
একটি শেল থাকাকালীন, am
সিনট্যাক্স হল:
am command
আপনি দূরবর্তী শেল প্রবেশ না করে সরাসরি adb
থেকে একটি কার্যকলাপ পরিচালক কমান্ড ইস্যু করতে পারেন। যেমন:
adb shell am start -a android.intent.action.VIEW
সারণী 1. উপলব্ধ কার্যকলাপ পরিচালক কমান্ড
আদেশ | বর্ণনা |
---|---|
start [ options ] intent | intent দ্বারা নির্দিষ্ট একটি Activity শুরু করুন।উদ্দেশ্য আর্গুমেন্টের জন্য স্পেসিফিকেশন দেখুন। বিকল্পগুলি হল:
|
startservice [ options ] intent | intent দ্বারা নির্দিষ্ট Service শুরু করুন।উদ্দেশ্য আর্গুমেন্টের জন্য স্পেসিফিকেশন দেখুন। বিকল্পগুলি হল:
|
force-stop package | package সাথে যুক্ত সবকিছু জোর করে বন্ধ করুন। |
kill [ options ] package | package সাথে যুক্ত সমস্ত প্রসেস মেরে ফেলুন। এই কমান্ডটি কেবলমাত্র সেই প্রক্রিয়াগুলিকে হত্যা করে যা হত্যা করা নিরাপদ এবং এটি ব্যবহারকারীর অভিজ্ঞতাকে প্রভাবিত করবে না।বিকল্পগুলি হল:
|
kill-all | সমস্ত ব্যাকগ্রাউন্ড প্রসেস মেরে ফেলুন। |
broadcast [ options ] intent | একটি সম্প্রচার অভিপ্রায় ইস্যু. উদ্দেশ্য আর্গুমেন্টের জন্য স্পেসিফিকেশন দেখুন। বিকল্পগুলি হল:
|
instrument [ options ] component | একটি Instrumentation উদাহরণ দিয়ে পর্যবেক্ষণ শুরু করুন। সাধারণত লক্ষ্য component ফর্ম test_package / runner_class ।বিকল্পগুলি হল:
|
profile start process file | process প্রোফাইলার শুরু করুন, file ফলাফল লিখুন। |
profile stop process | process প্রোফাইলার বন্ধ করুন। |
dumpheap [ options ] process file | process গাদা ডাম্প করুন, file লিখুন।বিকল্পগুলি হল:
|
dumpbitmaps [ options ] [-p process ] | process থেকে বিটম্যাপ তথ্য ডাম্প করুন (API স্তর 36 এবং তার উপরে)।বিকল্পগুলি হল:
process নির্দিষ্ট না থাকলে, সমস্ত প্রক্রিয়া থেকে বিটম্যাপ ডাম্প করা হবে। |
set-debug-app [ options ] package | ডিবাগ করার জন্য অ্যাপ package সেট করুন।বিকল্পগুলি হল:
|
clear-debug-app | set-debug-app দিয়ে ডিবাগ করার জন্য আগের সেটটি সাফ করুন। |
monitor [ options ] | ক্র্যাশ বা ANR-এর জন্য পর্যবেক্ষণ শুরু করুন। বিকল্পগুলি হল:
|
screen-compat {on | off} package | package পর্দা সামঞ্জস্যপূর্ণ মোড নিয়ন্ত্রণ করুন। |
display-size [reset | width x height ] | ডিভাইস প্রদর্শনের আকার ওভাররাইড করুন। এই কমান্ডটি একটি বড় স্ক্রীন সহ একটি ডিভাইস ব্যবহার করে একটি ছোট স্ক্রীন রেজোলিউশনের অনুকরণ করে বিভিন্ন স্ক্রীন সাইজ জুড়ে আপনার অ্যাপটি পরীক্ষা করার জন্য সহায়ক এবং এর বিপরীতে। উদাহরণ: |
display-density dpi | ডিভাইস প্রদর্শনের ঘনত্ব ওভাররাইড করুন। এই কমান্ডটি কম ঘনত্বের স্ক্রীন ব্যবহার করে উচ্চ-ঘনত্বের স্ক্রীন পরিবেশের অনুকরণ করে বিভিন্ন স্ক্রীনের ঘনত্ব জুড়ে আপনার অ্যাপ পরীক্ষা করার জন্য সহায়ক। উদাহরণ: |
to-uri intent | একটি URI হিসাবে প্রদত্ত অভিপ্রায় স্পেসিফিকেশন মুদ্রণ করুন. |
to-intent-uri intent | প্রদত্ত অভিপ্রায় স্পেসিফিকেশন একটি intent: URI. |
উদ্দেশ্য আর্গুমেন্ট জন্য স্পেসিফিকেশন
অ্যাক্টিভিটি ম্যানেজার কমান্ডগুলির জন্য যা একটি intent
যুক্তি গ্রহণ করে, আপনি নিম্নলিখিত বিকল্পগুলির সাথে অভিপ্রায় নির্দিষ্ট করতে পারেন:
প্যাকেজ ম্যানেজারকে কল করুন ( pm
)
একটি adb
শেলের মধ্যে, আপনি ডিভাইসে ইনস্টল করা অ্যাপ প্যাকেজগুলিতে অ্যাকশন এবং প্রশ্নগুলি সম্পাদন করতে প্যাকেজ ম্যানেজার ( pm
) টুলের সাহায্যে কমান্ড ইস্যু করতে পারেন।
একটি শেলে থাকাকালীন, pm
সিনট্যাক্স হল:
pm command
আপনি দূরবর্তী শেল প্রবেশ না করে সরাসরি adb
থেকে একটি প্যাকেজ ম্যানেজার কমান্ড ইস্যু করতে পারেন। যেমন:
adb shell pm uninstall com.example.MyApp
সারণি 2. উপলব্ধ প্যাকেজ ম্যানেজার কমান্ড
আদেশ | বর্ণনা |
---|---|
list packages [ options ] filter | সমস্ত প্যাকেজ প্রিন্ট করুন, ঐচ্ছিকভাবে শুধুমাত্র যাদের প্যাকেজের নাম filter লেখা আছে।বিকল্প:
|
list permission-groups | সমস্ত পরিচিত অনুমতি গ্রুপ প্রিন্ট করুন. |
list permissions [ options ] group | সমস্ত পরিচিত অনুমতি প্রিন্ট করুন, ঐচ্ছিকভাবে শুধুমাত্র group থাকা।বিকল্প:
|
list instrumentation [ options ] | সমস্ত পরীক্ষা প্যাকেজ তালিকা. বিকল্প:
|
list features | সিস্টেমের সমস্ত বৈশিষ্ট্য মুদ্রণ করুন। |
list libraries | বর্তমান ডিভাইস দ্বারা সমর্থিত সমস্ত লাইব্রেরি প্রিন্ট করুন। |
list users | সিস্টেমে সমস্ত ব্যবহারকারী মুদ্রণ করুন। |
path package | প্রদত্ত package APK-এর পথ প্রিন্ট করুন। |
install [ options ] path | সিস্টেমে path দ্বারা নির্দিষ্ট একটি প্যাকেজ ইনস্টল করুন।বিকল্প:
|
uninstall [ options ] package | সিস্টেম থেকে একটি প্যাকেজ সরিয়ে দেয়। বিকল্প:
|
clear package | একটি প্যাকেজের সাথে যুক্ত সমস্ত ডেটা মুছুন। |
enable package_or_component | প্রদত্ত প্যাকেজ বা উপাদান সক্রিয় করুন ("প্যাকেজ/শ্রেণী" হিসাবে লেখা)। |
disable package_or_component | প্রদত্ত প্যাকেজ বা উপাদান অক্ষম করুন ("প্যাকেজ/শ্রেণী" হিসাবে লেখা)। |
disable-user [ options ] package_or_component | বিকল্প:
|
grant package_name permission | একটি অ্যাপের অনুমতি দিন। Android 6.0 (API লেভেল 23) এবং উচ্চতর চলমান ডিভাইসগুলিতে, অনুমতিটি অ্যাপ ম্যানিফেস্টে ঘোষিত যেকোনো অনুমতি হতে পারে। Android 5.1 (API লেভেল 22) এবং তার নিচে চলমান ডিভাইসগুলিতে অ্যাপ দ্বারা সংজ্ঞায়িত একটি ঐচ্ছিক অনুমতি থাকতে হবে। |
revoke package_name permission | একটি অ্যাপ্লিকেশন থেকে একটি অনুমতি প্রত্যাহার করুন. Android 6.0 (API লেভেল 23) এবং উচ্চতর চলমান ডিভাইসগুলিতে, অনুমতিটি অ্যাপ ম্যানিফেস্টে ঘোষিত যেকোনো অনুমতি হতে পারে। Android 5.1 (API লেভেল 22) এবং তার নিচে চলমান ডিভাইসগুলিতে অ্যাপ দ্বারা সংজ্ঞায়িত একটি ঐচ্ছিক অনুমতি থাকতে হবে। |
set-install-location location | ডিফল্ট ইনস্টল অবস্থান পরিবর্তন করুন. অবস্থান মান:
দ্রষ্টব্য: এটি শুধুমাত্র ডিবাগ করার উদ্দেশ্যে করা হয়েছে। এটি ব্যবহার করলে অ্যাপগুলি ভেঙে যেতে পারে এবং অন্যান্য অবাঞ্ছিত আচরণ হতে পারে। |
get-install-location | বর্তমান ইনস্টলের অবস্থান ফেরত দেয়। রিটার্ন মান:
|
set-permission-enforced permission [true | false] | প্রদত্ত অনুমতি প্রয়োগ করা উচিত কিনা তা উল্লেখ করুন। |
trim-caches desired_free_space | প্রদত্ত ফাঁকা জায়গায় পৌঁছানোর জন্য ক্যাশে ফাইল ট্রিম করুন। |
create-user user_name | প্রদত্ত user_name দিয়ে একটি নতুন ব্যবহারকারী তৈরি করুন, ব্যবহারকারীর নতুন ব্যবহারকারী শনাক্তকারী মুদ্রণ করুন। |
remove-user user_id | প্রদত্ত user_id সহ ব্যবহারকারীকে সরান, সেই ব্যবহারকারীর সাথে যুক্ত সমস্ত ডেটা মুছে দিন |
get-max-users | ডিভাইস দ্বারা সমর্থিত ব্যবহারকারীদের সর্বাধিক সংখ্যা প্রিন্ট করুন। |
get-app-links [ options ] [ package ] | প্রদত্ত package জন্য ডোমেন যাচাইকরণ অবস্থা মুদ্রণ করুন, অথবা কোনোটি নির্দিষ্ট না থাকলে সমস্ত প্যাকেজের জন্য। রাজ্য কোড নিম্নরূপ সংজ্ঞায়িত করা হয়:
বিকল্পগুলি হল:
|
reset-app-links [ options ] [ package ] | প্রদত্ত প্যাকেজের জন্য ডোমেন যাচাইকরণ অবস্থা রিসেট করুন, অথবা কোনোটি নির্দিষ্ট না থাকলে সমস্ত প্যাকেজের জন্য।
বিকল্পগুলি হল:
|
verify-app-links [ --re-verify ] [ package ] | প্রদত্ত package জন্য একটি যাচাইকরণের অনুরোধ সম্প্রচার করুন, অথবা কোনোটি নির্দিষ্ট না থাকলে সমস্ত প্যাকেজের জন্য। প্যাকেজটি পূর্বে কোনো প্রতিক্রিয়া রেকর্ড না করলেই কেবল পাঠায়।
|
set-app-links [--package package ] state domains | একটি প্যাকেজের জন্য একটি ডোমেনের অবস্থা ম্যানুয়ালি সেট করুন। ডোমেনটি অবশ্যই প্যাকেজ দ্বারা এটি কাজ করার জন্য অটোভারিফাই হিসাবে ঘোষণা করতে হবে। এই কমান্ডটি প্রয়োগ করা যায়নি এমন ডোমেনগুলির জন্য কোনও ব্যর্থতার প্রতিবেদন করবে না।
|
set-app-links-user-selection --user user_id [--package package ] enabled domains | একটি প্যাকেজের জন্য ম্যানুয়ালি একটি হোস্ট ব্যবহারকারী নির্বাচনের অবস্থা সেট করুন। এটি কাজ করার জন্য ডোমেনটি প্যাকেজ দ্বারা ঘোষণা করতে হবে। এই কমান্ডটি প্রয়োগ করা যায়নি এমন ডোমেনগুলির জন্য কোনও ব্যর্থতার প্রতিবেদন করবে না।
|
set-app-links-allowed --user user_id [--package package ] allowed | একটি প্যাকেজের জন্য অটো-যাচাই করা লিঙ্ক-হ্যান্ডলিং সেটিংস টগল করুন।
|
get-app-link-owners --user user_id [--package package ] domains | নিম্ন থেকে উচ্চ-অগ্রাধিকার ক্রমে প্রদত্ত ব্যবহারকারীর জন্য নির্দিষ্ট ডোমেনের জন্য মালিকদের মুদ্রণ করুন।
|
কল ডিভাইস পলিসি ম্যানেজার ( dpm
)
আপনার ডিভাইস পরিচালনার অ্যাপ্লিকেশনগুলি বিকাশ ও পরীক্ষা করতে আপনাকে সহায়তা করতে, ডিভাইস পলিসি ম্যানেজার ( dpm
) সরঞ্জামটিতে কমান্ড জারি করুন। সক্রিয় অ্যাডমিন অ্যাপ্লিকেশন নিয়ন্ত্রণ করতে বা ডিভাইসে কোনও নীতিমালার স্থিতি ডেটা পরিবর্তন করতে সরঞ্জামটি ব্যবহার করুন।
শেলটিতে থাকাকালীন, dpm
সিনট্যাক্সটি হ'ল:
dpm command
আপনি কোনও দূরবর্তী শেল প্রবেশ না করে সরাসরি adb
থেকে একটি ডিভাইস পলিসি ম্যানেজার কমান্ডও জারি করতে পারেন:
adb shell dpm command
সারণী 3 উপলব্ধ ডিভাইস পলিসি ম্যানেজার কমান্ড
আদেশ | বর্ণনা |
---|---|
set-active-admin [ options ] component | সক্রিয় প্রশাসক হিসাবে component সেট করে। বিকল্পগুলি হল:
|
set-profile-owner [ options ] component | সক্রিয় প্রশাসক হিসাবে component এবং বিদ্যমান ব্যবহারকারীর জন্য প্রোফাইলের মালিক হিসাবে এর প্যাকেজ সেট করুন। বিকল্পগুলি হল:
|
set-device-owner [ options ] component | সক্রিয় প্রশাসক হিসাবে component এবং ডিভাইস মালিক হিসাবে এর প্যাকেজ সেট করুন। বিকল্পগুলি হল:
|
remove-active-admin [ options ] component | একটি সক্রিয় প্রশাসক অক্ষম করুন। অ্যাপ্লিকেশনটি অবশ্যই android:testOnly । এই কমান্ডটি ডিভাইস এবং প্রোফাইল মালিকদেরও সরিয়ে দেয়।বিকল্পগুলি হল:
|
clear-freeze-period-record | সিস্টেম ওটিএ আপডেটের জন্য পূর্বে সেট ফ্রিজ পিরিয়ডগুলির ডিভাইসের রেকর্ডটি সাফ করুন। ফ্রিজ পিরিয়ডগুলি পরিচালনা করে এমন অ্যাপ্লিকেশনগুলি বিকাশ করার সময় ডিভাইসের সময়সূচী বিধিনিষেধগুলি এড়াতে এটি দরকারী। সিস্টেম আপডেট পরিচালনা করুন দেখুন। অ্যান্ড্রয়েড 9.0 (এপিআই স্তর 28) এবং উচ্চতর চালিত ডিভাইসগুলিতে সমর্থিত। |
force-network-logs | কোনও ডিপিসি দ্বারা পুনরুদ্ধারের জন্য কোনও বিদ্যমান নেটওয়ার্ক লগ প্রস্তুত করতে সিস্টেমকে বাধ্য করুন। যদি সংযোগ বা ডিএনএস লগগুলি উপলব্ধ থাকে তবে ডিপিসি onNetworkLogsAvailable() কলব্যাক গ্রহণ করে। নেটওয়ার্ক ক্রিয়াকলাপ লগিং দেখুন।এই কমান্ডটি হার-সীমাবদ্ধ। অ্যান্ড্রয়েড 9.0 (এপিআই স্তর 28) এবং উচ্চতর চালিত ডিভাইসগুলিতে সমর্থিত। |
force-security-logs | সিস্টেমকে ডিপিসিতে যে কোনও বিদ্যমান সুরক্ষা লগ উপলব্ধ করতে বাধ্য করুন। যদি লগগুলি উপলব্ধ থাকে তবে ডিপিসি onSecurityLogsAvailable() কলব্যাক গ্রহণ করে। লগ এন্টারপ্রাইজ ডিভাইস ক্রিয়াকলাপ দেখুন।এই কমান্ডটি হার-সীমাবদ্ধ। অ্যান্ড্রয়েড 9.0 (এপিআই স্তর 28) এবং উচ্চতর চালিত ডিভাইসগুলিতে সমর্থিত। |
একটি স্ক্রিনশট নিন
screencap
কমান্ডটি একটি ডিভাইস ডিসপ্লে স্ক্রিনশট নেওয়ার জন্য একটি শেল ইউটিলিটি।
শেলটিতে থাকাকালীন, screencap
সিনট্যাক্সটি হ'ল:
screencap filename
কমান্ড লাইন থেকে screencap
ব্যবহার করতে, নিম্নলিখিতটি প্রবেশ করুন:
adb shell screencap /sdcard/screen.png
স্ক্রিনশটটি ক্যাপচার করতে adb
শেল ব্যবহার করে এবং ডিভাইস থেকে ফাইলটি ডাউনলোড করার জন্য pull
কমান্ডটি ব্যবহার করে এখানে একটি উদাহরণ স্ক্রিনশট সেশন রয়েছে:
$ adb shell shell@ $ screencap /sdcard/screen.png shell@ $ exit $ adb pull /sdcard/screen.png
একটি ভিডিও রেকর্ড করুন
screenrecord
কমান্ডটি অ্যান্ড্রয়েড 4.4 (এপিআই স্তর 19) এবং উচ্চতর চালিত ডিভাইসগুলির প্রদর্শন রেকর্ডিংয়ের জন্য একটি শেল ইউটিলিটি। ইউটিলিটি এমপিইজি -4 ফাইলটিতে স্ক্রিন ক্রিয়াকলাপ রেকর্ড করে। আপনি প্রচারমূলক বা প্রশিক্ষণ ভিডিও তৈরি করতে বা ডিবাগিং এবং পরীক্ষার জন্য এই ফাইলটি ব্যবহার করতে পারেন।
একটি শেল মধ্যে, নিম্নলিখিত সিনট্যাক্স ব্যবহার করুন:
screenrecord [options] filename
কমান্ড লাইন থেকে screenrecord
ব্যবহার করতে, নিম্নলিখিতগুলি প্রবেশ করুন:
adb shell screenrecord /sdcard/demo.mp4
নিয়ন্ত্রণ+সি টিপে স্ক্রিন রেকর্ডিং বন্ধ করুন। অন্যথায়, রেকর্ডিংটি তিন মিনিটে স্বয়ংক্রিয়ভাবে বন্ধ হয়ে যায় বা --time-limit
দ্বারা নির্ধারিত সময়সীমা।
আপনার ডিভাইসের স্ক্রিনটি রেকর্ড করা শুরু করতে, ভিডিওটি রেকর্ড করতে screenrecord
কমান্ডটি চালান। তারপরে, ডিভাইস থেকে হোস্ট কম্পিউটারে ভিডিওটি ডাউনলোড করতে pull
কমান্ডটি চালান। এখানে একটি উদাহরণ রেকর্ডিং সেশন:
$ adb shell shell@ $ screenrecord --verbose /sdcard/demo.mp4 (press Control + C to stop) shell@ $ exit $ adb pull /sdcard/demo.mp4
ডিভাইস প্রদর্শনের দিক অনুপাতটি ধরে রেখে screenrecord
ইউটিলিটি আপনার অনুরোধ করা যে কোনও সমর্থিত রেজোলিউশন এবং বিট রেট রেকর্ড করতে পারে। সর্বাধিক তিন মিনিটের দৈর্ঘ্যের সাথে ডিফল্টরূপে নেটিভ ডিসপ্লে রেজোলিউশন এবং ওরিয়েন্টেশনে ইউটিলিটি রেকর্ড করে।
screenrecord
ইউটিলিটির সীমাবদ্ধতা:
- ভিডিও ফাইলের সাথে অডিও রেকর্ড করা হয় না।
- ওয়েয়ার ওএস চলমান ডিভাইসগুলির জন্য ভিডিও রেকর্ডিং উপলব্ধ নয়।
- কিছু ডিভাইস তাদের নেটিভ ডিসপ্লে রেজোলিউশনে রেকর্ড করতে সক্ষম নাও হতে পারে। আপনি যদি স্ক্রিন রেকর্ডিংয়ের সাথে সমস্যার মুখোমুখি হন তবে কম স্ক্রিন রেজোলিউশনটি ব্যবহার করার চেষ্টা করুন।
- রেকর্ডিংয়ের সময় পর্দার ঘূর্ণন সমর্থিত নয়। রেকর্ডিংয়ের সময় যদি স্ক্রিনটি ঘোরানো হয় তবে কিছু স্ক্রিন রেকর্ডিংয়ে কেটে যায়।
সারণী 4। screenrecord
বিকল্পগুলি
অপশন | বর্ণনা |
---|---|
--help | কমান্ড সিনট্যাক্স এবং বিকল্পগুলি প্রদর্শন করুন |
--size width x height | ভিডিওর আকার সেট করুন: 1280x720 । ডিফল্ট মানটি হ'ল ডিভাইসের নেটিভ ডিসপ্লে রেজোলিউশন (যদি সমর্থিত হয়), 1280x720 যদি না হয়। সেরা ফলাফলের জন্য, আপনার ডিভাইসের উন্নত ভিডিও কোডিং (এভিসি) এনকোডার দ্বারা সমর্থিত একটি আকার ব্যবহার করুন। |
--bit-rate rate | ভিডিওর জন্য ভিডিও বিট রেট সেট করুন, প্রতি সেকেন্ডে মেগাবিটগুলিতে। ডিফল্ট মান 20 এমবিপিএস। আপনি ভিডিওর গুণমান উন্নত করতে বিট রেট বাড়াতে পারেন, কিন্তু এটি করার ফলে বড় মুভি ফাইল হয়। নিম্নলিখিত উদাহরণটি রেকর্ডিং বিট রেট 6 এমবিপিএসে সেট করে: screenrecord --bit-rate 6000000 /sdcard/demo.mp4 |
--time-limit time | সেকেন্ডে সর্বাধিক রেকর্ডিংয়ের সময় সেট করুন। ডিফল্ট এবং সর্বাধিক মান 180 (3 মিনিট)। |
--rotate | আউটপুট 90 ডিগ্রি ঘোরান। এই বৈশিষ্ট্যটি পরীক্ষামূলক। |
--verbose | কমান্ড-লাইন স্ক্রিনে লগ তথ্য প্রদর্শন করুন। আপনি যদি এই বিকল্পটি সেট না করেন তবে ইউটিলিটি চলাকালীন কোনও তথ্য প্রদর্শন করে না। |
অ্যাপ্লিকেশনগুলির জন্য আর্ট প্রোফাইলগুলি পড়ুন
অ্যান্ড্রয়েড 7.0 (এপিআই স্তর 24) থেকে শুরু করে, অ্যান্ড্রয়েড রানটাইম (এআরটি) ইনস্টল করা অ্যাপ্লিকেশনগুলির জন্য এক্সিকিউশন প্রোফাইল সংগ্রহ করে, যা অ্যাপের কার্যকারিতা অনুকূল করতে ব্যবহৃত হয়। কোন পদ্ধতিগুলি ঘন ঘন কার্যকর করা হয় এবং অ্যাপ্লিকেশন স্টার্টআপের সময় কোন ক্লাসগুলি ব্যবহৃত হয় তা বোঝার জন্য সংগৃহীত প্রোফাইলগুলি পরীক্ষা করুন।
দ্রষ্টব্য: আপনার যদি ফাইল সিস্টেমে রুট অ্যাক্সেস থাকে তবে উদাহরণস্বরূপ, কোনও এমুলেটরটিতে এক্সিকিউশন প্রোফাইল ফাইলের নামটি পুনরুদ্ধার করা সম্ভব।
প্রোফাইল তথ্যের একটি পাঠ্য ফর্ম তৈরি করতে, নিম্নলিখিত কমান্ডটি ব্যবহার করুন:
adb shell cmd package dump-profiles package
উত্পাদিত ফাইলটি পুনরুদ্ধার করতে, ব্যবহার:
adb pull /data/misc/profman/package.prof.txt
পরীক্ষা ডিভাইসগুলি পুনরায় সেট করুন
আপনি যদি একাধিক পরীক্ষার ডিভাইস জুড়ে আপনার অ্যাপ্লিকেশনটি পরীক্ষা করেন তবে পরীক্ষাগুলির মধ্যে আপনার ডিভাইসটি পুনরায় সেট করা কার্যকর হতে পারে, উদাহরণস্বরূপ, ব্যবহারকারীর ডেটা অপসারণ এবং পরীক্ষার পরিবেশটি পুনরায় সেট করতে। আপনি testharness
adb
শেল কমান্ড ব্যবহার করে অ্যান্ড্রয়েড 10 (এপিআই স্তর 29) বা উচ্চতর একটি পরীক্ষার ডিভাইসের কারখানার রিসেট করতে পারেন, যেমন দেখানো হয়েছে:
adb shell cmd testharness enable
testharness
ব্যবহার করে ডিভাইসটি পুনরুদ্ধার করার সময়, ডিভাইসটি স্বয়ংক্রিয়ভাবে আরএসএ কীটিকে ব্যাক আপ করে যা একটি অবিরাম স্থানে বর্তমান ওয়ার্কস্টেশনের মাধ্যমে ডিবাগিংয়ের অনুমতি দেয়। এটি হ'ল, ডিভাইসটি পুনরায় সেট করার পরে, ওয়ার্কস্টেশনটি কোনও নতুন কী নিবন্ধন না করে ডিভাইসে adb
কমান্ডগুলি ডিবাগ করতে এবং জারি করতে পারে।
অতিরিক্তভাবে, আপনার অ্যাপ্লিকেশনটি পরীক্ষা করা আরও সহজ এবং আরও সুরক্ষিত করতে সহায়তা করার জন্য, কোনও ডিভাইস পুনরুদ্ধার করতে testharness
ব্যবহার করে নিম্নলিখিত ডিভাইস সেটিংসও পরিবর্তন করে:
- ডিভাইসটি নির্দিষ্ট সিস্টেম সেটিংস সেট আপ করে যাতে প্রাথমিক ডিভাইস সেটআপ উইজার্ডগুলি উপস্থিত না হয়। এটি হ'ল, ডিভাইসটি এমন একটি রাজ্যে প্রবেশ করে যা থেকে আপনি দ্রুত আপনার অ্যাপ্লিকেশনটি ইনস্টল করতে, ডিবাগ করতে এবং পরীক্ষা করতে পারেন।
- সেটিংস:
- লক স্ক্রিন অক্ষম করে।
- জরুরী সতর্কতাগুলি অক্ষম করে।
- অ্যাকাউন্টগুলির জন্য অটো-সিঙ্ক অক্ষম করে।
- স্বয়ংক্রিয় সিস্টেম আপডেটগুলি অক্ষম করে।
- অন্যান্য:
- পূর্বনির্ধারিত সুরক্ষা অ্যাপ্লিকেশনগুলি অক্ষম করে।
যদি আপনার অ্যাপ্লিকেশনটিকে testharness
কমান্ডের ডিফল্ট সেটিংসে সনাক্ত এবং অভিযোজন করতে হবে তবে ActivityManager.isRunningInUserTestHarness()
sqlite
sqlite3
এসকিউএলাইট ডাটাবেসগুলি পরীক্ষা করার জন্য sqlite
কমান্ড-লাইন প্রোগ্রাম শুরু করে। এটিতে একটি টেবিলের বিষয়বস্তু মুদ্রণের জন্য .dump
এবং একটি বিদ্যমান টেবিলের জন্য SQL CREATE
বিবৃতি প্রিন্ট করার জন্য .schema
আপনি কমান্ড লাইন থেকে এসকিউএলাইট কমান্ডগুলিও কার্যকর করতে পারেন, যেমন দেখানো হয়েছে:
$ adb -s emulator-5554 shell $ sqlite3 /data/data/com.example.app/databases/rssitems.db SQLite version 3.3.12 Enter ".help" for instructions
দ্রষ্টব্য: আপনার যদি ফাইল সিস্টেমে রুট অ্যাক্সেস থাকে তবে কেবলমাত্র একটি এসকিউএলাইট ডাটাবেস অ্যাক্সেস করা সম্ভব, উদাহরণস্বরূপ, একটি এমুলেটরে।
আরও তথ্যের জন্য, sqlite3
কমান্ড লাইন ডকুমেন্টেশন দেখুন।
এডিবি ইউএসবি ব্যাকেন্ডস
এডিবি সার্ভার দুটি ব্যাকেন্ডের মাধ্যমে ইউএসবি স্ট্যাকের সাথে ইন্টারঅ্যাক্ট করতে পারে। এটি হয় ওএস (উইন্ডোজ, লিনাক্স বা ম্যাকোস) এর নেটিভ ব্যাকএন্ড ব্যবহার করতে পারে বা এটি libusb
ব্যাকএন্ড ব্যবহার করতে পারে। কিছু বৈশিষ্ট্য, যেমন attach
, detach
এবং ইউএসবি স্পিড সনাক্তকরণ কেবল libusb
ব্যাকএন্ড ব্যবহার করার সময় উপলব্ধ।
আপনি ADB_LIBUSB
এনভায়রনমেন্ট ভেরিয়েবল ব্যবহার করে একটি ব্যাকএন্ড চয়ন করতে পারেন। যদি এটি সেট না করা হয় তবে এডিবি তার ডিফল্ট ব্যাকএন্ড ব্যবহার করে। ডিফল্ট আচরণ ওএসের মধ্যে পরিবর্তিত হয়। এডিবি ভি 34 দিয়ে শুরু করে, liubusb
ব্যাকএন্ড উইন্ডোজ ব্যতীত সমস্ত ওএসে ডিফল্টরূপে ব্যবহৃত হয়, যেখানে নেটিভ ব্যাকেন্ডটি ডিফল্টরূপে ব্যবহৃত হয়। যদি ADB_LIBUSB
সেট করা থাকে তবে এটি নির্ধারণ করে যে নেটিভ ব্যাকএন্ড বা libusb
ব্যবহার করা হয়েছে কিনা। এডিবি পরিবেশের ভেরিয়েবলগুলি সম্পর্কে আরও তথ্যের জন্য এডিবি ম্যানুয়াল পৃষ্ঠাটি দেখুন।
এডিবি এমডিএনএস ব্যাকেন্ডস
এডিবি স্বয়ংক্রিয়ভাবে সার্ভার এবং ডিভাইসগুলিকে সংযুক্ত করতে মাল্টিকাস্ট ডিএনএস প্রোটোকল ব্যবহার করতে পারে। দুটি ব্যাকেন্ড, বনজুর (অ্যাপলের এমডিএনএসএসস্পেন্ডার) এবং ওপেনস্ক্রিন সহ এডিবি সার্ভার জাহাজগুলি।
হোস্ট মেশিনে চলার জন্য বনজুর ব্যাকএন্ডের একটি ডেমন দরকার। ম্যাকোসে অ্যাপলের অন্তর্নির্মিত ডেমন সর্বদা চলমান থাকে তবে উইন্ডোজ এবং লিনাক্সে, ব্যবহারকারীকে অবশ্যই mdnsd
ডেমন আপ এবং চলমান রয়েছে তা নিশ্চিত করতে হবে। যদি কমান্ড adb mdns check
একটি ত্রুটি দেয় তবে সম্ভবত এডিবি বনজুর ব্যাকএন্ড ব্যবহার করছে তবে কোনও বনজুর ডেমন চলমান নেই।
ওপেনস্ক্রিন ব্যাকএন্ডে মেশিনে চলার জন্য কোনও ডেমন দরকার নেই। ম্যাকোসে ওপেনস্ক্রিন ব্যাকএন্ডের জন্য সমর্থন এডিবি ভি 35 থেকে শুরু হয়। উইন্ডোজ এবং লিনাক্স এডিবি ভি 34 হিসাবে সমর্থিত।
ডিফল্টরূপে এডিবি বনজুর ব্যাকএন্ড ব্যবহার করে। এই আচরণটি পরিবেশের পরিবর্তনশীল ADB_MDNS_OPENSCREEN
( 1
বা 0
এ সেট করা) ব্যবহার করে পরিবর্তন করা যেতে পারে। আরও তথ্যের জন্য এডিবি ম্যানুয়াল পৃষ্ঠাটি দেখুন।
এডিবি বার্স্ট মোড (এডিবি 36.0.0 দিয়ে শুরু)
বার্স্ট মোড একটি পরীক্ষামূলক বৈশিষ্ট্য যা ডিভাইসটি পূর্ববর্তী প্যাকেটে প্রতিক্রিয়া জানানোর আগেই কোনও ডিভাইসে প্যাকেট প্রেরণ করতে দেয়। এটি বড় ফাইলগুলি স্থানান্তর করার সময় এডিবির থ্রুপুটকে ব্যাপকভাবে বাড়িয়ে তোলে এবং ডিবাগ করার সময় বিলম্বও হ্রাস করে।
বার্স্ট মোড ডিফল্টরূপে অক্ষম করা হয়। বৈশিষ্ট্যটি সক্ষম করতে, নিম্নলিখিতগুলির মধ্যে একটি করুন:
- পরিবেশের পরিবর্তনশীল
ADB_DELAYED_ACK
1
এ সেট করুন। - অ্যান্ড্রয়েড স্টুডিওতে, ফাইলের ডিবাগার সেটিংসে যান (বা ম্যাকোসে অ্যান্ড্রয়েড স্টুডিও ) > সেটিংস> বিল্ড, এক্সিকিউশন, ডিপ্লোয়মেন্ট> ডিবাগার এবং সক্ষম করার জন্য এডিবি সার্ভার বার্স্ট মোড সেট করুন।
অ্যান্ড্রয়েড ডিবাগ ব্রিজ ( adb
) একটি বহুমুখী কমান্ড-লাইন টুল যা আপনাকে একটি ডিভাইসের সাথে যোগাযোগ করতে দেয়। adb
কমান্ড বিভিন্ন ডিভাইস ক্রিয়াকলাপ যেমন অ্যাপ্লিকেশন ইনস্টল এবং ডিবাগিং অ্যাপ্লিকেশনগুলিকে সহায়তা করে। adb
একটি ইউনিক্স শেল অ্যাক্সেস সরবরাহ করে যা আপনি কোনও ডিভাইসে বিভিন্ন কমান্ড চালাতে ব্যবহার করতে পারেন। এটি একটি ক্লায়েন্ট-সার্ভার প্রোগ্রাম যা তিনটি উপাদান অন্তর্ভুক্ত করে:
- একটি ক্লায়েন্ট , যা কমান্ড প্রেরণ করে। ক্লায়েন্ট আপনার উন্নয়ন মেশিনে চালায়। আপনি কোনও
adb
কমান্ড জারি করে কমান্ড-লাইন টার্মিনাল থেকে ক্লায়েন্টকে অনুরোধ করতে পারেন। - একটি ডেমন (এডিবিডি) , যা কোনও ডিভাইসে কমান্ড চালায়। ডেমন প্রতিটি ডিভাইসে ব্যাকগ্রাউন্ড প্রক্রিয়া হিসাবে চলে।
- একটি সার্ভার , যা ক্লায়েন্ট এবং ডেমনের মধ্যে যোগাযোগ পরিচালনা করে। সার্ভারটি আপনার উন্নয়ন মেশিনে ব্যাকগ্রাউন্ড প্রক্রিয়া হিসাবে চলে।
adb
অ্যান্ড্রয়েড এসডিকে প্ল্যাটফর্ম সরঞ্জাম প্যাকেজে অন্তর্ভুক্ত রয়েছে। এসডিকে ম্যানেজারের সাথে এই প্যাকেজটি ডাউনলোড করুন, যা এটি android_sdk /platform-tools/
এ ইনস্টল করে। আপনি যদি স্ট্যান্ডেলোন অ্যান্ড্রয়েড এসডিকে প্ল্যাটফর্ম সরঞ্জাম প্যাকেজটি চান তবে এটি এখানে ডাউনলোড করুন ।
সাধারণ সমস্যাগুলি সমাধান করার জন্য সংযোগ সহকারীকে কীভাবে ব্যবহার করতে হয় তা সহ adb
ব্যবহারের জন্য কোনও ডিভাইস সংযোগ করার তথ্যের জন্য, একটি হার্ডওয়্যার ডিভাইসে রান অ্যাপ্লিকেশনগুলি দেখুন।
কিভাবে এডিবি কাজ করে
আপনি যখন কোনও adb
ক্লায়েন্ট শুরু করেন, ক্লায়েন্ট প্রথমে কোনও adb
সার্ভার প্রক্রিয়া ইতিমধ্যে চলছে কিনা তা পরীক্ষা করে। যদি না থাকে তবে এটি সার্ভার প্রক্রিয়া শুরু করে। যখন সার্ভারটি শুরু হয়, এটি স্থানীয় টিসিপি পোর্ট 5037 এর সাথে আবদ্ধ হয় এবং adb
ক্লায়েন্টদের কাছ থেকে প্রেরিত কমান্ডগুলি শুনে।
দ্রষ্টব্য: সমস্ত adb
ক্লায়েন্টরা adb
সার্ভারের সাথে যোগাযোগ করতে পোর্ট 5037 ব্যবহার করে।
সার্ভারটি তারপরে সমস্ত চলমান ডিভাইসে সংযোগগুলি সেট আপ করে। এটি 5555 থেকে 5585 পরিসরে বিজোড় সংখ্যাযুক্ত পোর্টগুলি স্ক্যান করে এমুলেটরগুলি সনাক্ত করে, যা প্রথম 16 টি এমুলেটর দ্বারা ব্যবহৃত পরিসীমা। যেখানে সার্ভারটি একটি adb
ডেমন (এডিবিডি) সন্ধান করে, এটি সেই বন্দরটির সাথে একটি সংযোগ স্থাপন করে।
প্রতিটি এমুলেটর একজোড়া সিক্যুয়াল পোর্ট ব্যবহার করে-কনসোল সংযোগের জন্য একটি সমান সংখ্যাযুক্ত পোর্ট এবং adb
সংযোগগুলির জন্য একটি বিজোড়-সংখ্যাযুক্ত পোর্ট। যেমন:
এমুলেটর 1, কনসোল: 5554
এমুলেটর 1, adb
: 5555
এমুলেটর 2, কনসোল: 5556
এমুলেটর 2, adb
: 5557
এবং তাই
যেমন দেখানো হয়েছে, 5555 পোর্টে adb
সংযুক্ত এমুলেটরটি এমুলেটর হিসাবে একই, যার কনসোলটি 5554 পোর্টে শোনা যায়।
সার্ভারটি সমস্ত ডিভাইসে সংযোগ স্থাপন করার পরে, আপনি সেই ডিভাইসগুলি অ্যাক্সেস করতে adb
কমান্ডগুলি ব্যবহার করতে পারেন। যেহেতু সার্ভারটি ডিভাইসগুলির সাথে সংযোগগুলি পরিচালনা করে এবং একাধিক adb
ক্লায়েন্ট থেকে কমান্ডগুলি পরিচালনা করে, আপনি কোনও ক্লায়েন্ট বা কোনও স্ক্রিপ্ট থেকে যে কোনও ডিভাইস নিয়ন্ত্রণ করতে পারেন।
আপনার ডিভাইসে এডিবি ডিবাগিং সক্ষম করুন
ইউএসবিতে সংযুক্ত কোনও ডিভাইস সহ এডিবি ব্যবহার করতে, আপনাকে অবশ্যই বিকাশকারী বিকল্পগুলির অধীনে ডিভাইস সিস্টেম সেটিংসে ইউএসবি ডিবাগিং সক্ষম করতে হবে। অ্যান্ড্রয়েড 4.2 (এপিআই স্তর 17) এবং উচ্চতর, বিকাশকারী বিকল্পগুলি স্ক্রিনটি ডিফল্টরূপে লুকানো থাকে। এটি দৃশ্যমান করতে, বিকাশকারী বিকল্পগুলি সক্ষম করুন।
আপনি এখন আপনার ডিভাইসটি ইউএসবির সাথে সংযুক্ত করতে পারেন। আপনি যাচাই করতে পারেন যে আপনার ডিভাইসটি android_sdk /platform-tools/
ডিরেক্টরি থেকে adb devices
সম্পাদন করে সংযুক্ত রয়েছে। যদি সংযুক্ত থাকে তবে আপনি "ডিভাইস" হিসাবে তালিকাভুক্ত ডিভাইসের নামটি দেখতে পাবেন।
দ্রষ্টব্য: আপনি যখন অ্যান্ড্রয়েড 4.2.2 (এপিআই স্তর 17) বা উচ্চতর চলমান কোনও ডিভাইস সংযুক্ত করেন, তখন সিস্টেমটি একটি ডায়ালগ দেখায় যে এই কম্পিউটারের মাধ্যমে ডিবাগিংয়ের অনুমতি দেয় এমন কোনও আরএসএ কী গ্রহণ করতে হবে কিনা তা জিজ্ঞাসা করে। এই সুরক্ষা প্রক্রিয়াটি ব্যবহারকারী ডিভাইসগুলিকে রক্ষা করে কারণ এটি নিশ্চিত করে যে ইউএসবি ডিবাগিং এবং অন্যান্য এডিবি কমান্ডগুলি কার্যকর করা যাবে না যদি না আপনি ডিভাইসটি আনলক করতে এবং ডায়ালগটি স্বীকৃতি দিতে সক্ষম হন।
ইউএসবি থেকে কোনও ডিভাইসে সংযোগ স্থাপন সম্পর্কে আরও তথ্যের জন্য, একটি হার্ডওয়্যার ডিভাইসে রান অ্যাপ্লিকেশনগুলি পড়ুন।
ওয়াই-ফাইয়ের উপরে কোনও ডিভাইসে সংযুক্ত করুন
দ্রষ্টব্য: নীচের নির্দেশাবলী অ্যান্ড্রয়েড 11 (এপিআই স্তর 30) চলমান ডিভাইস পরতে প্রযোজ্য নয়। আরও তথ্যের জন্য একটি ওয়েয়ার ওএস অ্যাপ্লিকেশন ডিবাগ করার গাইড দেখুন।
অ্যান্ড্রয়েড 11 (এপিআই স্তর 30) এবং অ্যান্ড্রয়েড ডিবাগ ব্রিজ (এডিবি) ব্যবহার করে আপনার ওয়ার্কস্টেশন থেকে আপনার অ্যাপ্লিকেশনটি ওয়্যারলেসভাবে মোতায়েন এবং ডিবাগ করা উচ্চতর সমর্থন। উদাহরণস্বরূপ, আপনি ইউএসবির মাধ্যমে আপনার ডিভাইসটিকে শারীরিকভাবে সংযুক্ত করার প্রয়োজন ছাড়াই একাধিক দূরবর্তী ডিভাইসে আপনার ডিবাগেবল অ্যাপ্লিকেশন স্থাপন করতে পারেন। এটি ড্রাইভার ইনস্টলেশনের মতো সাধারণ USB সংযোগ সমস্যাগুলি মোকাবেলা করার প্রয়োজনীয়তা দূর করে।
আপনি ওয়্যারলেস ডিবাগিং ব্যবহার শুরু করার আগে নিম্নলিখিতগুলি করুন:
আপনার ওয়ার্কস্টেশন এবং ডিভাইস একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত আছে তা নিশ্চিত করুন।
নিশ্চিত করুন যে আপনার ডিভাইসটি অ্যান্ড্রয়েড 11 (এপিআই স্তর 30) বা ফোন বা অ্যান্ড্রয়েড 13 (এপিআই স্তর 33) বা টিভি এবং পরিধানের জন্য উচ্চতর বা তার বেশি চলছে। আরও তথ্যের জন্য, আপনার অ্যান্ড্রয়েড সংস্করণ দেখুন এবং আপডেট করুন ।
যদি আইডিই ব্যবহার করে তবে আপনার অ্যান্ড্রয়েড স্টুডিওর সর্বশেষতম সংস্করণ ইনস্টল করা হয়েছে তা নিশ্চিত করুন। আপনি এখানে এটি ডাউনলোড করতে পারেন.
আপনার ওয়ার্কস্টেশনে, এসডিকে প্ল্যাটফর্ম সরঞ্জামগুলির সর্বশেষ সংস্করণে আপডেট করুন।
ওয়্যারলেস ডিবাগিং ব্যবহার করতে, আপনাকে অবশ্যই কিউআর কোড বা একটি জুটি কোড ব্যবহার করে আপনার ডিভাইসটি আপনার ওয়ার্কস্টেশনে যুক্ত করতে হবে। আপনার ওয়ার্কস্টেশন এবং ডিভাইস অবশ্যই একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত থাকতে হবে। আপনার ডিভাইসের সাথে সংযোগ করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
আপনার ডিভাইসে বিকাশকারী বিকল্পগুলি সক্ষম করুন ।
অ্যান্ড্রয়েড স্টুডিও খুলুন এবং রান কনফিগারেশন মেনু থেকে ওয়াই-ফাই ব্যবহার করে জোড় ডিভাইসগুলি নির্বাচন করুন।
চিত্র 1। কনফিগারেশন মেনু চালান।Wi-Fi উইন্ডোর উপরে জুটি ডিভাইসগুলি পপ আপ হয়, যেমন চিত্র 2 এ দেখানো হয়েছে।
চিত্র 2। কিউআর কোড বা জুড়ি কোড ব্যবহার করে ডিভাইসগুলি জুড়ি করতে পপআপ উইন্ডো।আপনার ডিভাইসে, ওয়্যারলেস ডিবাগিংয়ে আলতো চাপুন এবং আপনার ডিভাইসটি যুক্ত করুন:
চিত্র 3। গুগল পিক্সেল ফোনে ওয়্যারলেস ডিবাগিং সেটিংয়ের স্ক্রিনশট।আপনার ডিভাইসটিকে একটি কিউআর কোডের সাথে জুড়ি দেওয়ার জন্য, কিউআর কোড সহ জুড়ি ডিভাইসটি নির্বাচন করুন এবং চিত্র 2-এ দেখানো ওয়াই-ফাই পপআপের মাধ্যমে জোড় ডিভাইসগুলি থেকে প্রাপ্ত কিউআর কোডটি স্ক্যান করুন।
আপনার ডিভাইসটিকে একটি জুড়ি কোডের সাথে জুড়তে, ওয়াই-ফাই পপআপের ওপরে জুটি ডিভাইসগুলি থেকে জুটি কোড সহ জোড় ডিভাইসটি নির্বাচন করুন। আপনার ডিভাইসে, জুড়ি কোড ব্যবহার করে জুড়ি নির্বাচন করুন এবং প্রদত্ত ছয়-অঙ্কের কোডটি নোট করুন। আপনার ডিভাইসটি ওয়াই-ফাই উইন্ডোতে জুটি ডিভাইসে উপস্থিত হয়ে গেলে আপনি জুটি নির্বাচন করতে পারেন এবং আপনার ডিভাইসে প্রদর্শিত ছয়-অঙ্কের কোডটি প্রবেশ করতে পারেন।
চিত্র 4। ছয়-অঙ্কের কোড এন্ট্রি উদাহরণ।
আপনার ডিভাইসটি জোড় করার পরে, আপনি আপনার অ্যাপ্লিকেশনটি আপনার ডিভাইসে মোতায়েন করার চেষ্টা করতে পারেন।
একটি ভিন্ন ডিভাইস যুক্ত করতে বা আপনার ওয়ার্কস্টেশনে বর্তমান ডিভাইসটি ভুলে যেতে, আপনার ডিভাইসে ওয়্যারলেস ডিবাগিংয়ে নেভিগেট করুন। জোড়যুক্ত ডিভাইসের নীচে আপনার ওয়ার্কস্টেশন নামটি আলতো চাপুন এবং ভুলে যান নির্বাচন করুন।
আপনি যদি দ্রুত ওয়্যারলেস ডিবাগিং চালু এবং বন্ধ করতে চান তবে আপনি ওয়্যারলেস ডিবাগিংয়ের জন্য দ্রুত সেটিংস বিকাশকারী টাইলগুলি ব্যবহার করতে পারেন, বিকাশকারী বিকল্পগুলি > কুইক সেটিংস বিকাশকারী টাইলগুলিতে পাওয়া যায়।
চিত্র 5। দ্রুত সেটিংস বিকাশকারী টাইলস সেটিং আপনাকে দ্রুত ওয়্যারলেস ডিবাগিং চালু এবং বন্ধ করতে দেয়।
কমান্ড লাইন ব্যবহার করে ওয়াই-ফাই সংযোগ
বিকল্পভাবে, অ্যান্ড্রয়েড স্টুডিও ছাড়াই কমান্ড লাইন ব্যবহার করে আপনার ডিভাইসে সংযোগ করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
পূর্বে বর্ণিত হিসাবে আপনার ডিভাইসে বিকাশকারী বিকল্পগুলি সক্ষম করুন।
পূর্বে বর্ণিত হিসাবে আপনার ডিভাইসে ওয়্যারলেস ডিবাগিং সক্ষম করুন।
আপনার ওয়ার্কস্টেশনে, একটি টার্মিনাল উইন্ডো খুলুন এবং
android_sdk/platform-tools
নেভিগেট করুন।জুটি কোড সহ জুটি ডিভাইস নির্বাচন করে আপনার আইপি ঠিকানা, পোর্ট নম্বর এবং জুড়ি কোডটি সন্ধান করুন। ডিভাইসে প্রদর্শিত আইপি ঠিকানা, পোর্ট নম্বর এবং জুড়ি কোডটি নোট করুন।
আপনার ওয়ার্কস্টেশনের টার্মিনালে,
adb pair ipaddr:port
চালান। উপরে থেকে আইপি ঠিকানা এবং পোর্ট নম্বর ব্যবহার করুন।যখন অনুরোধ করা হয়, নীচে দেখানো হিসাবে জুটি কোড লিখুন।
চিত্র 6। একটি বার্তা ইঙ্গিত দেয় যে আপনার ডিভাইসটি সফলভাবে যুক্ত করা হয়েছে।
ওয়্যারলেস সংযোগ সমস্যাগুলি সমাধান করুন
আপনার যদি আপনার ডিভাইসের সাথে ওয়্যারলেসভাবে সংযোগ স্থাপনের সমস্যাগুলি থাকে তবে সমস্যাটি সমাধানের জন্য নিম্নলিখিত সমস্যা সমাধানের পদক্ষেপগুলি ব্যবহার করে দেখুন।
আপনার ওয়ার্কস্টেশন এবং ডিভাইস পূর্বশর্তগুলি পূরণ করে কিনা তা পরীক্ষা করে দেখুন
ওয়ার্কস্টেশন এবং ডিভাইসটি এই বিভাগের শুরুতে তালিকাভুক্ত পূর্বশর্তগুলি পূরণ করে কিনা তা পরীক্ষা করে দেখুন।
অন্যান্য পরিচিত সমস্যাগুলির জন্য পরীক্ষা করুন
নীচে ওয়্যারলেস ডিবাগিং (এডিবি বা অ্যান্ড্রয়েড স্টুডিও সহ) এবং কীভাবে সেগুলি সমাধান করবেন তা সহ বর্তমান পরিচিত সমস্যাগুলির একটি তালিকা রয়েছে:
ওয়াই-ফাই সংযোগ করছে না : কর্পোরেট ওয়াই-ফাই নেটওয়ার্কগুলির মতো সুরক্ষিত ওয়াই-ফাই নেটওয়ার্কগুলি পি 2 পি সংযোগগুলি অবরুদ্ধ করতে পারে এবং আপনাকে ওয়াই-ফাইয়ের সাথে সংযোগ করতে দেয় না। একটি কেবল বা অন্য (নন-কর্প) ওয়াই-ফাই নেটওয়ার্কের সাথে সংযোগ স্থাপনের চেষ্টা করুন।
adb connect ip : port
(প্রাথমিক ইউএসবি সংযোগ অনুসরণ করে) অন্য একটি বিকল্প, যদি কোনও অর্ক-কর্প নেটওয়ার্কের অবলম্বন করা একটি বিকল্প।ওয়াই-ফাই ওভার
adb
কখনও কখনও স্বয়ংক্রিয়ভাবে বন্ধ হয়ে যায় : ডিভাইসটি যদি ওয়াই-ফাই নেটওয়ার্কগুলি স্যুইচ করে বা নেটওয়ার্ক থেকে সংযোগ বিচ্ছিন্ন করে দেয় তবে এটি ঘটতে পারে। সমাধান করতে, নেটওয়ার্কে পুনরায় সংযোগ করুন।সাফল্যের সাথে জুড়ি দেওয়ার পরে ডিভাইস সংযোগ না করে :
adb
এমডিএনগুলির উপর নির্ভর করে এবং স্বয়ংক্রিয়ভাবে জোড়যুক্ত ডিভাইসগুলির সাথে সংযোগ স্থাপন করে। যদি আপনার নেটওয়ার্ক বা ডিভাইস কনফিগারেশন এমডিএনগুলিকে সমর্থন না করে বা এটি অক্ষম করে দেয় তবে আপনাকেadb connect ip : port
ব্যবহার করে ম্যানুয়ালি ডিভাইসে সংযোগ করতে হবে।
প্রাথমিক ইউএসবি সংযোগের পরে কোনও ডিভাইসের সাথে ওয়্যারলেসভাবে সংযুক্ত করুন (কেবলমাত্র অ্যান্ড্রয়েড 10 এবং তার চেয়ে কম বিকল্প বিকল্প)
দ্রষ্টব্য: এই কর্মপ্রবাহটি অ্যান্ড্রয়েড 11 (এবং উচ্চতর) এর ক্ষেত্রেও প্রযোজ্য, এটি হ'ল এটি শারীরিক ইউএসবি -র তুলনায় একটি * প্রাথমিক * সংযোগও জড়িত।
দ্রষ্টব্য: অ্যান্ড্রয়েড 10 (এপিআই স্তর 29) বা তার চেয়ে কম চলমান ডিভাইসগুলি পরতে নিম্নলিখিত নির্দেশাবলী প্রযোজ্য নয়। আরও তথ্যের জন্য একটি ওয়েয়ার ওএস অ্যাপ্লিকেশন ডিবাগ করার বিষয়ে গাইডটি দেখুন।
adb
সাধারণত ইউএসবি-র মাধ্যমে ডিভাইসের সাথে যোগাযোগ করে তবে আপনি ওয়াই-ফাইয়ের মাধ্যমে adb
ব্যবহার করতে পারেন। অ্যান্ড্রয়েড 10 (এপিআই স্তর 29) চলমান কোনও ডিভাইস সংযুক্ত করতে বা কম, ইউএসবি -র মাধ্যমে এই প্রাথমিক পদক্ষেপগুলি অনুসরণ করুন:
- আপনার অ্যান্ড্রয়েড ডিভাইস এবং
adb
হোস্ট কম্পিউটারকে একটি সাধারণ ওয়াই-ফাই নেটওয়ার্কের সাথে সংযুক্ত করুন। - একটি ইউএসবি কেবলের সাথে ডিভাইসটি হোস্ট কম্পিউটারে সংযুক্ত করুন।
- 5555 পোর্টে একটি টিসিপি/আইপি সংযোগ শোনার জন্য লক্ষ্য ডিভাইসটি সেট করুন:
adb tcpip 5555
- লক্ষ্য ডিভাইস থেকে ইউএসবি কেবলটি সংযোগ বিচ্ছিন্ন করুন।
- অ্যান্ড্রয়েড ডিভাইসের আইপি ঠিকানাটি সন্ধান করুন। উদাহরণস্বরূপ, একটি নেক্সাস ডিভাইসে, আপনি ট্যাবলেট (বা ফোন সম্পর্কে )> স্থিতি > আইপি ঠিকানা সম্পর্কে সেটিংস > এ আইপি ঠিকানাটি খুঁজে পেতে পারেন।
- ডিভাইসটির আইপি ঠিকানা দ্বারা সংযুক্ত করুন:
adb connect device_ip_address:5555
- আপনার হোস্ট কম্পিউটারটি লক্ষ্য ডিভাইসের সাথে সংযুক্ত রয়েছে তা নিশ্চিত করুন:
$ adb devices List of devices attached device_ip_address:5555 device
দ্রষ্টব্য: সাবধান থাকুন যে সমস্ত অ্যাক্সেস পয়েন্ট উপযুক্ত নয়। আপনার অ্যাক্সেস পয়েন্টটি ব্যবহার করতে হবে যার ফায়ারওয়াল adb
সমর্থন করার জন্য সঠিকভাবে কনফিগার করা হয়েছে।
আপনার ডিভাইসটি এখন adb
সাথে সংযুক্ত।
যদি আপনার ডিভাইসের adb
সংযোগটি হারিয়ে যায়:
- নিশ্চিত হয়ে নিন যে আপনার হোস্টটি এখনও আপনার অ্যান্ড্রয়েড ডিভাইসের মতো একই ওয়াই-ফাই নেটওয়ার্কের সাথে সংযুক্ত রয়েছে।
- আবার
adb connect
পদক্ষেপটি সম্পাদন করে পুনরায় সংযোগ করুন। - যদি এটি কাজ না করে তবে আপনার
adb
হোস্টটি পুনরায় সেট করুন:adb kill-server
তারপরে শুরু থেকেই শুরু করুন।
ডিভাইসগুলির জন্য ক্যোয়ারী
adb
কমান্ড দেওয়ার আগে, adb
সার্ভারের সাথে কোন ডিভাইস উদাহরণগুলি সংযুক্ত রয়েছে তা জানতে সহায়ক। devices
কমান্ড ব্যবহার করে সংযুক্ত ডিভাইসের একটি তালিকা তৈরি করুন:
adb devices -l
প্রতিক্রিয়া হিসাবে, adb
প্রতিটি ডিভাইসের জন্য এই স্থিতির তথ্য মুদ্রণ করে:
- সিরিয়াল নম্বর:
adb
তার পোর্ট নম্বর দ্বারা ডিভাইসটিকে অনন্যভাবে সনাক্ত করতে একটি স্ট্রিং তৈরি করে। এখানে একটি উদাহরণ সিরিয়াল নম্বর:emulator-5554
- রাজ্য: ডিভাইসের সংযোগ অবস্থা নিম্নলিখিতগুলির মধ্যে একটি হতে পারে:
-
offline
: ডিভাইসটিadb
সাথে সংযুক্ত নয় বা সাড়া দিচ্ছে না। -
device
: ডিভাইসটিadb
সার্ভারের সাথে সংযুক্ত। নোট করুন যে এই রাষ্ট্রটি বোঝায় না যে অ্যান্ড্রয়েড সিস্টেমটি সম্পূর্ণরূপে বুট এবং অপারেশনাল, কারণ সিস্টেমটি এখনও বুট করার সময় ডিভাইসটিadb
সাথে সংযোগ স্থাপন করে। বুট-আপ করার পরে, এটি কোনও ডিভাইসের স্বাভাবিক অপারেশনাল অবস্থা। -
no device
: কোনও ডিভাইস সংযুক্ত নেই।
-
- বর্ণনা: আপনি যদি
-l
বিকল্পটি অন্তর্ভুক্ত করেন তবেdevices
কমান্ড আপনাকে ডিভাইসটি কী তা জানায়। আপনার একাধিক ডিভাইস সংযুক্ত থাকলে এই তথ্যটি সহায়ক যাতে আপনি সেগুলি আলাদা করে বলতে পারেন।
নিম্নলিখিত উদাহরণটি devices
কমান্ড এবং এর আউটপুট দেখায়। তিনটি ডিভাইস চলছে। তালিকার প্রথম দুটি লাইন হ'ল এমুলেটর এবং তৃতীয় লাইনটি একটি হার্ডওয়্যার ডিভাইস যা কম্পিউটারের সাথে সংযুক্ত থাকে।
$ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo
এমুলেটর তালিকাভুক্ত নয়
adb devices
কমান্ডের একটি কর্নার-কেস কমান্ড সিকোয়েন্স রয়েছে যা আপনার ডেস্কটপে এমুলেটরগুলি দৃশ্যমান থাকা সত্ত্বেও চলমান এমুলেটরগুলি adb devices
আউটপুটে প্রদর্শিত না হয়। নিম্নলিখিত সমস্ত শর্তগুলি সত্য হলে এটি ঘটে:
-
adb
সার্ভার চলছে না। - আপনি 5554 এবং 5584 এর মধ্যে একটি বিজোড় সংখ্যাযুক্ত পোর্ট মান সহ
-port
বা-ports
বিকল্পের সাথেemulator
কমান্ডটি ব্যবহার করেন। - আপনি যে বিজোড় সংখ্যাযুক্ত পোর্টটি বেছে নিয়েছেন তা ব্যস্ত নয়, সুতরাং পোর্ট সংযোগটি নির্দিষ্ট পোর্ট নম্বরটিতে তৈরি করা যেতে পারে-বা, যদি এটি ব্যস্ত থাকে তবে এমুলেটরটি অন্য কোনও পোর্টে স্যুইচ করে যা 2 এর প্রয়োজনীয়তা পূরণ করে।
- আপনি এমুলেটরটি শুরু করার পরে আপনি
adb
সার্ভারটি শুরু করুন।
এই পরিস্থিতি এড়ানোর একটি উপায় হ'ল এমুলেটরটিকে তার নিজস্ব বন্দরগুলি বেছে নেওয়া এবং একবারে 16 টি এমুলেটর চালানো। আরেকটি উপায় হ'ল আপনি emulator
কমান্ডটি ব্যবহার করার আগে সর্বদা adb
সার্ভারটি শুরু করা, যেমনটি নিম্নলিখিত উদাহরণগুলিতে ব্যাখ্যা করা হয়েছে।
উদাহরণ 1: নিম্নলিখিত কমান্ড সিকোয়েন্সে, adb devices
কমান্ড adb
সার্ভার শুরু করে, তবে ডিভাইসের তালিকা উপস্থিত হয় না।
adb
সার্ভারটি বন্ধ করুন এবং প্রদর্শিত ক্রমে নিম্নলিখিত কমান্ডগুলি প্রবেশ করুন। এভিডি নামের জন্য, আপনার সিস্টেম থেকে একটি বৈধ এভিডি নাম সরবরাহ করুন। এভিডি নামগুলির একটি তালিকা পেতে, emulator -list-avds
টাইপ করুন। emulator
কমান্ডটি android_sdk /tools
ডিরেক্টরিতে রয়েছে।
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5555 $ adb devices List of devices attached * daemon not running. starting it now on port 5037 * * daemon started successfully *
উদাহরণ 2: নিম্নলিখিত কমান্ড সিকোয়েন্সে, adb devices
ডিভাইসের তালিকা প্রদর্শন করে কারণ adb
সার্ভারটি প্রথমে শুরু হয়েছিল।
adb devices
আউটপুটে এমুলেটরটি দেখতে, adb
সার্ভারটি বন্ধ করুন এবং তারপরে emulator
কমান্ডটি ব্যবহার করার পরে এবং adb devices
কমান্ডটি ব্যবহার করার আগে এটি আবার শুরু করুন:
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices List of devices attached emulator-5557 device
এমুলেটর কমান্ড-লাইন বিকল্পগুলি সম্পর্কে আরও তথ্যের জন্য, কমান্ড-লাইন স্টার্টআপ বিকল্পগুলি দেখুন।
একটি নির্দিষ্ট ডিভাইসে কমান্ড প্রেরণ করুন
যদি একাধিক ডিভাইস চলমান থাকে তবে আপনি adb
কমান্ডটি জারি করার সময় আপনাকে অবশ্যই লক্ষ্য ডিভাইসটি নির্দিষ্ট করতে হবে। লক্ষ্য নির্দিষ্ট করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
- লক্ষ্যটির ক্রমিক নম্বর পেতে
devices
কমান্ডটি ব্যবহার করুন। - আপনার যদি সিরিয়াল নম্বরটি হয়ে যায়, সিরিয়াল নম্বর নির্দিষ্ট করতে
adb
কমান্ডগুলির সাথে-s
বিকল্পটি ব্যবহার করুন।- আপনি যদি প্রচুর
adb
কমান্ড ইস্যু করতে চলেছেন তবে পরিবর্তে সিরিয়াল নম্বরটি ধারণ করতে আপনি$ANDROID_SERIAL
এনভায়রনমেন্ট ভেরিয়েবল সেট করতে পারেন। - আপনি যদি উভয়ই
-s
এবং$ANDROID_SERIAL
ব্যবহার করেন তবে-s
ওভাররাইড করে$ANDROID_SERIAL
।
- আপনি যদি প্রচুর
নিম্নলিখিত উদাহরণে, সংযুক্ত ডিভাইসের তালিকা প্রাপ্ত হয় এবং তারপরে ডিভাইসের একটির সিরিয়াল সংখ্যাটি সেই ডিভাইসে helloWorld.apk
ইনস্টল করতে ব্যবহৃত হয়:
$ adb devices List of devices attached emulator-5554 device emulator-5555 device 0.0.0.0:6520 device # To install on emulator-5555 $ adb -s emulator-5555 install helloWorld.apk # To install on 0.0.0.0:6520 $ adb -s 0.0.0.0:6520 install helloWorld.apk
দ্রষ্টব্য: আপনি যদি একাধিক ডিভাইস উপলভ্য থাকলে কোনও লক্ষ্য ডিভাইস নির্দিষ্ট না করে কমান্ড জারি করেন তবে adb
একটি ত্রুটি "এডিবি: একাধিক ডিভাইস/এমুলেটর" প্রদর্শন করে।
আপনার যদি একাধিক ডিভাইস উপলব্ধ থাকে তবে কেবলমাত্র একটি এমুলেটর হয় তবে এমুলেটরটিতে কমান্ডগুলি প্রেরণের জন্য -e
বিকল্পটি ব্যবহার করুন। যদি একাধিক ডিভাইস থাকে তবে কেবল একটি হার্ডওয়্যার ডিভাইস সংযুক্ত থাকে তবে হার্ডওয়্যার ডিভাইসে কমান্ডগুলি প্রেরণে -d
বিকল্পটি ব্যবহার করুন।
একটি অ্যাপ ইনস্টল করুন
আপনি install
কমান্ডের সাথে একটি এমুলেটর বা সংযুক্ত ডিভাইসে একটি এপিকে ইনস্টল করতে adb
ব্যবহার করতে পারেন:
adb install path_to_apk
আপনি যখন কোনও পরীক্ষার APK ইনস্টল করার সময় আপনাকে অবশ্যই install
কমান্ডের সাথে -t
বিকল্পটি ব্যবহার করতে হবে। আরও তথ্যের জন্য, দেখুন -t
।
একাধিক এপিকে ইনস্টল করতে install-multiple
ব্যবহার করুন। আপনি যদি প্লে কনসোল থেকে আপনার অ্যাপ্লিকেশনটির জন্য নির্দিষ্ট ডিভাইসের জন্য সমস্ত APKS ডাউনলোড করেন এবং এগুলি একটি এমুলেটর বা শারীরিক ডিভাইসে ইনস্টল করতে চান তবে এটি দরকারী।
আপনি কোনও এমুলেটর/ডিভাইস উদাহরণে ইনস্টল করতে পারেন এমন একটি এপিকে ফাইল কীভাবে তৈরি করবেন সে সম্পর্কে আরও তথ্যের জন্য, আপনার অ্যাপটি বিল্ড এবং চালান দেখুন।
দ্রষ্টব্য: আপনি যদি অ্যান্ড্রয়েড স্টুডিও ব্যবহার করছেন তবে এমুলেটর বা ডিভাইসে আপনার অ্যাপ্লিকেশনটি ইনস্টল করতে আপনাকে সরাসরি adb
ব্যবহার করার দরকার নেই। পরিবর্তে, অ্যান্ড্রয়েড স্টুডিও আপনার জন্য অ্যাপটির প্যাকেজিং এবং ইনস্টলেশন পরিচালনা করে।
পোর্ট ফরওয়ার্ডিং সেট আপ করুন
স্বেচ্ছাসেবী পোর্ট ফরওয়ার্ডিং সেট আপ করতে forward
কমান্ডটি ব্যবহার করুন, যা কোনও ডিভাইসের আলাদা পোর্টে নির্দিষ্ট হোস্ট পোর্টে অনুরোধগুলি ফরোয়ার্ড করে। নিম্নলিখিত উদাহরণটি ডিভাইস পোর্ট 7100 এ হোস্ট পোর্ট 6100 এর ফরোয়ার্ডিং সেট করে:
adb forward tcp:6100 tcp:7100
নিম্নলিখিত উদাহরণটি স্থানীয়ভাবে হোস্ট পোর্ট 6100 এর ফরোয়ার্ডিং সেট করে: লগড:
adb forward tcp:6100 local:logd
আপনি যদি ডিভাইসের কোনও প্রদত্ত বন্দরে যা পাঠানো হচ্ছে তা সনাক্ত করার চেষ্টা করছেন তবে এটি কার্যকর হতে পারে। সমস্ত প্রাপ্ত ডেটা সিস্টেম-লগিং ডেমনকে লেখা হবে এবং ডিভাইস লগগুলিতে প্রদর্শিত হবে।
কোনও ডিভাইসে এবং থেকে ফাইলগুলি অনুলিপি করুন
কোনও ডিভাইসে এবং থেকে ফাইলগুলি অনুলিপি করতে pull
এবং push
কমান্ডগুলি ব্যবহার করুন। install
কমান্ডের বিপরীতে, যা কেবলমাত্র একটি নির্দিষ্ট স্থানে একটি এপিকে ফাইল অনুলিপি করে, pull
এবং push
কমান্ডগুলি আপনাকে কোনও ডিভাইসের যে কোনও স্থানে স্বেচ্ছাসেবী ডিরেক্টরি এবং ফাইলগুলি অনুলিপি করতে দেয়।
ডিভাইস থেকে কোনও ফাইল বা ডিরেক্টরি এবং এর সাব-ডিরেক্টরিগুলি অনুলিপি করতে, নিম্নলিখিতগুলি করুন:
adb pull remote local
কোনও ফাইল বা ডিরেক্টরি এবং এর সাব-ডিরেক্টরিগুলি ডিভাইসে অনুলিপি করতে, নিম্নলিখিতগুলি করুন:
adb push local remote
আপনার বিকাশ মেশিনে (স্থানীয়) এবং ডিভাইসে (রিমোট) টার্গেট ফাইল/ডিরেক্টরিতে পাথগুলির সাথে local
এবং remote
প্রতিস্থাপন করুন। যেমন:
adb push myfile.txt /sdcard/myfile.txt
এডিবি সার্ভার বন্ধ করুন
কিছু ক্ষেত্রে, আপনাকে adb
সার্ভার প্রক্রিয়াটি বন্ধ করতে হবে এবং তারপরে সমস্যাটি সমাধানের জন্য এটি পুনরায় চালু করতে হবে। উদাহরণস্বরূপ, যদি adb
কোনও কমান্ডের প্রতিক্রিয়া না দেয় তবে এটি হতে পারে।
adb
সার্ভার বন্ধ করতে, adb kill-server
কমান্ডটি ব্যবহার করুন। তারপরে আপনি অন্য কোনও adb
কমান্ড জারি করে সার্ভারটি পুনরায় চালু করতে পারেন।
এডিবি কমান্ড ইস্যু করুন
আপনার উন্নয়ন মেশিনে কমান্ড লাইন থেকে বা নিম্নলিখিতগুলি ব্যবহার করে কোনও স্ক্রিপ্ট থেকে adb
কমান্ড জারি করুন:
adb [-d | -e | -s serial_number] command
যদি কেবলমাত্র একটি এমুলেটর চলমান বা কেবলমাত্র একটি ডিভাইস সংযুক্ত থাকে তবে adb
কমান্ডটি ডিফল্টরূপে সেই ডিভাইসে প্রেরণ করা হয়। যদি একাধিক এমুলেটর চলমান থাকে এবং/অথবা একাধিক ডিভাইস সংযুক্ত থাকে তবে আপনাকে কমান্ডটি নির্দেশিত হওয়া উচিত এমন লক্ষ্য ডিভাইসটি নির্দিষ্ট করতে -d
, -e
, বা -s
বিকল্পটি ব্যবহার করতে হবে।
আপনি নিম্নলিখিত কমান্ডটি ব্যবহার করে সমস্ত সমর্থিত adb
কমান্ডের বিশদ তালিকা দেখতে পারেন:
adb --help
শেল কমান্ড ইস্যু
আপনি adb
মাধ্যমে ডিভাইস কমান্ড জারি করতে বা একটি ইন্টারেক্টিভ শেল শুরু করতে shell
কমান্ডটি ব্যবহার করতে পারেন। একটি একক কমান্ড জারি করতে, shell
কমান্ডটি এর মতো ব্যবহার করুন:
adb [-d |-e | -s serial_number] shell shell_command
কোনও ডিভাইসে একটি ইন্টারেক্টিভ শেল শুরু করতে, shell
কমান্ডটি এর মতো ব্যবহার করুন:
adb [-d | -e | -s serial_number] shell
একটি ইন্টারেক্টিভ শেল থেকে প্রস্থান করতে, Control+D
টিপুন বা exit
টাইপ করুন।
অ্যান্ড্রয়েড বেশিরভাগ সাধারণ ইউনিক্স কমান্ড-লাইন সরঞ্জাম সরবরাহ করে। উপলভ্য সরঞ্জামগুলির তালিকার জন্য, নিম্নলিখিত কমান্ডটি ব্যবহার করুন:
adb shell ls /system/bin
--help
আর্গুমেন্টের মাধ্যমে বেশিরভাগ কমান্ডের জন্য সহায়তা উপলব্ধ। শেল কমান্ডগুলির অনেকগুলিই টয়বক্স দ্বারা সরবরাহ করা হয়। সমস্ত টয়বক্স কমান্ডের জন্য প্রযোজ্য সাধারণ সহায়তা toybox --help
মাধ্যমে উপলব্ধ।
অ্যান্ড্রয়েড প্ল্যাটফর্ম সরঞ্জাম 23 এবং উচ্চতর সহ, adb
ssh(1)
কমান্ডটি একইভাবে যুক্তিগুলি পরিচালনা করে। এই পরিবর্তনটি কমান্ড ইনজেকশন নিয়ে প্রচুর সমস্যা সমাধান করেছে এবং শেল মেটাচারাকটার রয়েছে এমন কমান্ডগুলি নিরাপদে সম্পাদন করা সম্ভব করে তোলে, যেমন adb install Let\'sGo.apk
। এই পরিবর্তনের অর্থ হ'ল শেল মেটাচারাকটার রয়েছে এমন কোনও কমান্ডের ব্যাখ্যাও পরিবর্তিত হয়েছে।
উদাহরণস্বরূপ, adb shell setprop key ' two words '
এখন একটি ত্রুটি, কারণ উক্তিগুলি স্থানীয় শেল দ্বারা গ্রাস করা হয় এবং ডিভাইসটি adb shell setprop key two words
দেখায়। কমান্ডটি কাজ করার জন্য, দু'বার উদ্ধৃত করুন, একবার স্থানীয় শেলের জন্য এবং একবার রিমোট শেলের জন্য, যেমন আপনি ssh(1)
এর সাথে করেন। উদাহরণস্বরূপ, adb shell setprop key "' two words '"
কাজ করে কারণ স্থানীয় শেলটি উদ্ধৃতি দেওয়ার বাইরের স্তর নেয় এবং ডিভাইসটি এখনও উদ্ধৃতি দেওয়ার অভ্যন্তরীণ স্তরটি দেখে: setprop key 'two words'
। পালানোও একটি বিকল্প, তবে দু'বার উদ্ধৃত করা সাধারণত সহজ।
লগক্যাট কমান্ড-লাইন সরঞ্জামটিও দেখুন, যা সিস্টেম লগ পর্যবেক্ষণের জন্য দরকারী।
কল ক্রিয়াকলাপ পরিচালক
একটি adb
শেলের মধ্যে, আপনি বিভিন্ন সিস্টেমের ক্রিয়া সম্পাদনের জন্য ক্রিয়াকলাপ পরিচালক ( am
) সরঞ্জামের সাথে কমান্ডগুলি জারি করতে পারেন, যেমন একটি ক্রিয়াকলাপ শুরু করা, একটি প্রক্রিয়া জোর করে স্টপ, একটি অভিপ্রায় সম্প্রচার, ডিভাইস স্ক্রিনের বৈশিষ্ট্যগুলি সংশোধন করা এবং আরও অনেক কিছু।
শেলটিতে থাকাকালীন, am
সিনট্যাক্সটি হ'ল:
am command
আপনি দূরবর্তী শেল প্রবেশ না করে সরাসরি adb
থেকে একটি ক্রিয়াকলাপ পরিচালক কমান্ডও জারি করতে পারেন। যেমন:
adb shell am start -a android.intent.action.VIEW
সারণী 1 উপলব্ধ ক্রিয়াকলাপ পরিচালক কমান্ড
আদেশ | বর্ণনা |
---|---|
start [ options ] intent | intent দ্বারা নির্দিষ্ট একটি Activity শুরু করুন।অভিপ্রায় যুক্তিগুলির জন্য স্পেসিফিকেশন দেখুন। বিকল্পগুলি হল:
|
startservice [ options ] intent | intent দ্বারা নির্দিষ্ট Service শুরু করুন।অভিপ্রায় যুক্তিগুলির জন্য স্পেসিফিকেশন দেখুন। বিকল্পগুলি হল:
|
force-stop package | package সাথে সম্পর্কিত সমস্ত কিছু জোর করে স্টপ করুন। |
kill [ options ] package | package সাথে সম্পর্কিত সমস্ত প্রক্রিয়া হত্যা করুন। এই কমান্ডটি কেবল এমন প্রক্রিয়াগুলিকে হত্যা করে যা হত্যা করা নিরাপদ এবং এটি ব্যবহারকারীর অভিজ্ঞতাকে প্রভাবিত করবে না।বিকল্পগুলি হল:
|
kill-all | সমস্ত পটভূমি প্রক্রিয়া হত্যা। |
broadcast [ options ] intent | একটি সম্প্রচার অভিপ্রায় জারি করুন। See the Specification for intent arguments . বিকল্পগুলি হল:
|
instrument [ options ] component | Start monitoring with an Instrumentation instance. Typically the target component is the form test_package / runner_class .বিকল্পগুলি হল:
|
profile start process file | Start profiler on process , write results to file . |
profile stop process | Stop profiler on process . |
dumpheap [ options ] process file | Dump the heap of process , write to file .বিকল্পগুলি হল:
|
dumpbitmaps [ options ] [-p process ] | Dump bitmap information from process (API level 36 and above).বিকল্পগুলি হল:
process is specified, bitmaps from all processes will be dumped. |
set-debug-app [ options ] package | Set app package to debug.বিকল্পগুলি হল:
|
clear-debug-app | Clear the package previous set for debugging with set-debug-app . |
monitor [ options ] | Start monitoring for crashes or ANRs. বিকল্পগুলি হল:
|
screen-compat {on | off} package | Control screen compatibility mode of package . |
display-size [reset | width x height ] | Override device display size. This command is helpful for testing your app across different screen sizes by mimicking a small screen resolution using a device with a large screen, and vice versa. উদাহরণ: |
display-density dpi | Override device display density. This command is helpful for testing your app across different screen densities by mimicking a high-density screen environment using a low-density screen, and vice versa. উদাহরণ: |
to-uri intent | Print the given intent specification as a URI. See the Specification for intent arguments . |
to-intent-uri intent | Print the given intent specification as an intent: URI.See the Specification for intent arguments . |
Specification for intent arguments
For activity manager commands that take an intent
argument, you can specify the intent with the following options:
Call package manager ( pm
)
Within an adb
shell, you can issue commands with the package manager ( pm
) tool to perform actions and queries on app packages installed on the device.
While in a shell, the pm
syntax is:
pm command
You can also issue a package manager command directly from adb
without entering a remote shell. যেমন:
adb shell pm uninstall com.example.MyApp
Table 2. Available package manager commands
আদেশ | বর্ণনা |
---|---|
list packages [ options ] filter | Print all packages, optionally only those whose package name contains the text in filter .বিকল্প:
|
list permission-groups | Print all known permission groups. |
list permissions [ options ] group | Print all known permissions, optionally only those in group .বিকল্প:
|
list instrumentation [ options ] | List all test packages. বিকল্প:
|
list features | Print all features of the system. |
list libraries | Print all the libraries supported by the current device. |
list users | Print all users on the system. |
path package | Print the path to the APK of the given package . |
install [ options ] path | Install a package, specified by path , to the system.বিকল্প:
|
uninstall [ options ] package | Removes a package from the system. বিকল্প:
|
clear package | Delete all data associated with a package. |
enable package_or_component | Enable the given package or component (written as "package/class"). |
disable package_or_component | Disable the given package or component (written as "package/class"). |
disable-user [ options ] package_or_component | বিকল্প:
|
grant package_name permission | Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. |
revoke package_name permission | Revoke a permission from an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. |
set-install-location location | Change the default install location. Location values:
Note: This is only intended for debugging. Using this can cause apps to break and other undesireable behavior. |
get-install-location | Returns the current install location. রিটার্ন মান:
|
set-permission-enforced permission [true | false] | Specify whether the given permission should be enforced. |
trim-caches desired_free_space | Trim cache files to reach the given free space. |
create-user user_name | Create a new user with the given user_name , printing the new user identifier of the user. |
remove-user user_id | Remove the user with the given user_id , deleting all data associated with that user |
get-max-users | Print the maximum number of users supported by the device. |
get-app-links [ options ] [ package ] | Print the domain verification state for the given package , or for all packages if none is specified. State codes are defined as follows:
বিকল্পগুলি হল:
|
reset-app-links [ options ] [ package ] | Reset domain verification state for the given package, or for all packages if none is specified.
বিকল্পগুলি হল:
|
verify-app-links [ --re-verify ] [ package ] | Broadcast a verification request for the given package , or for all packages if none is specified. Only sends if the package has previously not recorded a response.
|
set-app-links [--package package ] state domains | Manually set the state of a domain for a package. The domain must be declared by the package as autoVerify for this to work. This command will not report a failure for domains that could not be applied.
|
set-app-links-user-selection --user user_id [--package package ] enabled domains | Manually set the state of a host user selection for a package. The domain must be declared by the package for this to work. This command will not report a failure for domains that could not be applied.
|
set-app-links-allowed --user user_id [--package package ] allowed | Toggle the auto-verified link-handling setting for a package.
|
get-app-link-owners --user user_id [--package package ] domains | Print the owners for a specific domain for a given user in low- to high-priority order.
|
Call device policy manager ( dpm
)
To help you develop and test your device management apps, issue commands to the device policy manager ( dpm
) tool. Use the tool to control the active admin app or change a policy's status data on the device.
While in a shell, the dpm
syntax is:
dpm command
You can also issue a device policy manager command directly from adb
without entering a remote shell:
adb shell dpm command
Table 3. Available device policy manager commands
আদেশ | বর্ণনা |
---|---|
set-active-admin [ options ] component | Sets component as active admin. বিকল্পগুলি হল:
|
set-profile-owner [ options ] component | Set component as active admin and its package as profile owner for an existing user. বিকল্পগুলি হল:
|
set-device-owner [ options ] component | Set component as active admin and its package as device owner. বিকল্পগুলি হল:
|
remove-active-admin [ options ] component | Disable an active admin. The app must declare android:testOnly in the manifest. This command also removes device and profile owners.বিকল্পগুলি হল:
|
clear-freeze-period-record | Clear the device's record of previously set freeze periods for system OTA updates. This is useful to avoid the device scheduling restrictions when developing apps that manage freeze periods. See Manage system updates . Supported on devices running Android 9.0 (API level 28) and higher. |
force-network-logs | Force the system to make any existing network logs ready for retrieval by a DPC. If there are connection or DNS logs available, the DPC receives the onNetworkLogsAvailable() callback. See Network activity logging .This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. |
force-security-logs | Force the system to make any existing security logs available to the DPC. If there are logs available, the DPC receives the onSecurityLogsAvailable() callback. See Log enterprise device activity .This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. |
একটি স্ক্রিনশট নিন
The screencap
command is a shell utility for taking a screenshot of a device display.
While in a shell, the screencap
syntax is:
screencap filename
To use screencap
from the command line, enter the following:
adb shell screencap /sdcard/screen.png
Here's an example screenshot session, using the adb
shell to capture the screenshot and the pull
command to download the file from the device:
$ adb shell shell@ $ screencap /sdcard/screen.png shell@ $ exit $ adb pull /sdcard/screen.png
একটি ভিডিও রেকর্ড করুন
The screenrecord
command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file. You can use this file to create promotional or training videos or for debugging and testing.
In a shell, use the following syntax:
screenrecord [options] filename
To use screenrecord
from the command line, enter the following:
adb shell screenrecord /sdcard/demo.mp4
Stop the screen recording by pressing Control+C. Otherwise, the recording stops automatically at three minutes or the time limit set by --time-limit
.
To begin recording your device screen, run the screenrecord
command to record the video. Then, run the pull
command to download the video from the device to the host computer. Here's an example recording session:
$ adb shell shell@ $ screenrecord --verbose /sdcard/demo.mp4 (press Control + C to stop) shell@ $ exit $ adb pull /sdcard/demo.mp4
The screenrecord
utility can record at any supported resolution and bit rate you request, while retaining the aspect ratio of the device display. The utility records at the native display resolution and orientation by default, with a maximum length of three minutes.
Limitations of the screenrecord
utility:
- ভিডিও ফাইলের সাথে অডিও রেকর্ড করা হয় না।
- Video recording is not available for devices running Wear OS.
- Some devices might not be able to record at their native display resolution. If you encounter problems with screen recording, try using a lower screen resolution.
- Rotation of the screen during recording is not supported. If the screen does rotate during recording, some of the screen is cut off in the recording.
Table 4. screenrecord
options
অপশন | বর্ণনা |
---|---|
--help | Display command syntax and options |
--size width x height | Set the video size: 1280x720 . The default value is the device's native display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder. |
--bit-rate rate | Set the video bit rate for the video, in megabits per second. The default value is 20Mbps. আপনি ভিডিওর গুণমান উন্নত করতে বিট রেট বাড়াতে পারেন, কিন্তু এটি করার ফলে বড় মুভি ফাইল হয়। The following example sets the recording bit rate to 6Mbps: screenrecord --bit-rate 6000000 /sdcard/demo.mp4 |
--time-limit time | Set the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes). |
--rotate | Rotate the output 90 degrees. এই বৈশিষ্ট্যটি পরীক্ষামূলক। |
--verbose | Display log information on the command-line screen. If you do not set this option, the utility does not display any information while running. |
Read ART profiles for apps
Starting in Android 7.0 (API level 24), the Android Runtime (ART) collects execution profiles for installed apps, which are used to optimize app performance. Examine the collected profiles to understand which methods are executed frequently and which classes are used during app startup.
Note: It is only possible to retrieve the execution profile filename if you have root access to the file system, for example, on an emulator.
To produce a text form of the profile information, use the following command:
adb shell cmd package dump-profiles package
To retrieve the file produced, use:
adb pull /data/misc/profman/package.prof.txt
Reset test devices
If you test your app across multiple test devices, it may be useful to reset your device between tests, for example, to remove user data and reset the test environment. You can perform a factory reset of a test device running Android 10 (API level 29) or higher using the testharness
adb
shell command, as shown:
adb shell cmd testharness enable
When restoring the device using testharness
, the device automatically backs up the RSA key that allows debugging through the current workstation in a persistent location. That is, after the device is reset, the workstation can continue to debug and issue adb
commands to the device without manually registering a new key.
Additionally, to help make it easier and more secure to keep testing your app, using the testharness
to restore a device also changes the following device settings:
- The device sets up certain system settings so that initial device setup wizards do not appear. That is, the device enters a state from which you can quickly install, debug, and test your app.
- সেটিংস:
- Disables lock screen.
- Disables emergency alerts.
- Disables auto-sync for accounts.
- Disables automatic system updates.
- অন্যান্য:
- Disables preinstalled security apps.
If your app needs to detect and adapt to the default settings of the testharness
command, use the ActivityManager.isRunningInUserTestHarness()
.
sqlite
sqlite3
starts the sqlite
command-line program for examining SQLite databases. It includes commands such as .dump
to print the contents of a table and .schema
to print the SQL CREATE
statement for an existing table. You can also execute SQLite commands from the command line, as shown:
$ adb -s emulator-5554 shell $ sqlite3 /data/data/com.example.app/databases/rssitems.db SQLite version 3.3.12 Enter ".help" for instructions
Note: It is only possible to access a SQLite database if you have root access to the file system, for example, on an emulator.
For more information, see the sqlite3
command line documentation .
adb USB backends
The adb server can interact with the USB stack through two backends. It can either use the native backend of the OS (Windows, Linux, or macOS) or it can use the libusb
backend. Some features, such as attach
, detach
, and USB speed detection, are only available when using libusb
backend.
You can choose a backend by using the ADB_LIBUSB
environment variable. If it isn't set, adb uses its default backend. The default behavior varies among OS. Starting with ADB v34 , the liubusb
backend is used by default on all OS except Windows, where the native backend is used by default. If ADB_LIBUSB
is set, it determines whether the native backend or libusb
is used. See the adb manual page for more information about adb environment variables.
adb mDNS backends
ADB can use the multicast DNS protocol to automatically connect the server and devices. The ADB server ships with two backends, Bonjour (Apple's mdnsResponder) and Openscreen.
The Bonjour backend needs a daemon to be running on the host machine. On macOS Apple's built-in daemon is always running, but on Windows and Linux, the user must make sure the mdnsd
daemon is up and running. If the command adb mdns check
returns an error, it is likely that ADB is using the Bonjour backend but there is no Bonjour daemon running.
The Openscreen backend does not need a daemon to be running on the machine. Support for the Openscreen backend on macOS starts at ADB v35. Windows and Linux are supported as of ADB v34.
By default ADB uses the Bonjour backend. This behavior can be changed using the environment variable ADB_MDNS_OPENSCREEN
(set to 1
or 0
). See the ADB manual page for further details.
adb Burst Mode (starting with ADB 36.0.0)
Burst Mode is an experimental feature that lets ADB to keep on sending packets to a device even before the device has responded to the previous packet. This greatly increases the throughput of ADB when transferring large files and also reduces latency while debugging.
Burst Mode is disabled by default. To enable the feature, do one of the following:
- Set the environment variable
ADB_DELAYED_ACK
to1
. - In Android Studio, go to the debugger settings at File (or Android Studio on macOS) > Settings > Build, Execution, Deployment > Debugger and set ADB Server Burst Mode to Enabled .
অ্যান্ড্রয়েড ডিবাগ ব্রিজ ( adb
) একটি বহুমুখী কমান্ড-লাইন টুল যা আপনাকে একটি ডিভাইসের সাথে যোগাযোগ করতে দেয়। The adb
command facilitates a variety of device actions, such as installing and debugging apps. adb
provides access to a Unix shell that you can use to run a variety of commands on a device. এটি একটি ক্লায়েন্ট-সার্ভার প্রোগ্রাম যা তিনটি উপাদান অন্তর্ভুক্ত করে:
- A client , which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an
adb
command. - A daemon (adbd) , which runs commands on a device. The daemon runs as a background process on each device.
- A server , which manages communication between the client and the daemon. The server runs as a background process on your development machine.
adb
is included in the Android SDK Platform Tools package. Download this package with the SDK Manager , which installs it at android_sdk /platform-tools/
. If you want the standalone Android SDK Platform Tools package, download it here .
For information on connecting a device for use over adb
, including how to use the Connection Assistant to troubleshoot common problems, see Run apps on a hardware device .
How adb works
When you start an adb
client, the client first checks whether there is an adb
server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb
clients.
Note: All adb
clients use port 5037 to communicate with the adb
server.
The server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range 5555 to 5585, which is the range used by the first 16 emulators. Where the server finds an adb
daemon (adbd), it sets up a connection to that port.
Each emulator uses a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb
connections. যেমন:
Emulator 1, console: 5554
Emulator 1, adb
: 5555
Emulator 2, console: 5556
Emulator 2, adb
: 5557
এবং তাই
As shown, the emulator connected to adb
on port 5555 is the same as the emulator whose console listens on port 5554.
Once the server has set up connections to all devices, you can use adb
commands to access those devices. Because the server manages connections to devices and handles commands from multiple adb
clients, you can control any device from any client or from a script.
Enable adb debugging on your device
To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options . On Android 4.2 (API level 17) and higher, the Developer options screen is hidden by default. To make it visible, enable Developer options.
You can now connect your device with USB. You can verify that your device is connected by executing adb devices
from the android_sdk /platform-tools/
directory. If connected, you'll see the device name listed as a "device."
Note: When you connect a device running Android 4.2.2 (API level 17) or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog.
For more information about connecting to a device over USB, read Run apps on a hardware device .
Connect to a device over Wi-Fi
Note: The instructions below do not apply to Wear devices running Android 11 (API level 30). See the guide to debugging a Wear OS app for more information.
Android 11 (API level 30) and higher support deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without ever needing to physically connect your device via USB. এটি ড্রাইভার ইনস্টলেশনের মতো সাধারণ USB সংযোগ সমস্যাগুলি মোকাবেলা করার প্রয়োজনীয়তা দূর করে।
Before you begin using wireless debugging, do the following:
আপনার ওয়ার্কস্টেশন এবং ডিভাইস একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত আছে তা নিশ্চিত করুন।
Ensure that your device is running Android 11 (API level 30) or higher for phone or Android 13 (API level 33) or higher for TV and WearOS. আরও তথ্যের জন্য, আপনার অ্যান্ড্রয়েড সংস্করণ দেখুন এবং আপডেট করুন ।
If using the IDE, ensure that you have the latest version of Android Studio installed. আপনি এখানে এটি ডাউনলোড করতে পারেন.
On your workstation, update to the latest version of the SDK Platform Tools .
To use wireless debugging, you must pair your device to your workstation using a QR code or a pairing code. আপনার ওয়ার্কস্টেশন এবং ডিভাইস অবশ্যই একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত থাকতে হবে। আপনার ডিভাইসের সাথে সংযোগ করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
Enable developer options on your device.
Open Android Studio and select Pair Devices Using Wi-Fi from the run configurations menu.
Figure 1. Run configurations menu.The Pair devices over Wi-Fi window pops up, as shown in figure 2.
Figure 2. Popup window to pair devices using QR code or pairing code.On your device, tap Wireless debugging and pair your device:
Figure 3. Screenshot of the Wireless debugging setting on a Google Pixel phone.To pair your device with a QR code, select Pair device with QR code and scan the QR code obtained from the Pair devices over Wi-Fi popup shown in figure 2.
To pair your device with a pairing code, select Pair device with pairing code from the Pair devices over Wi-Fi popup. On your device, select Pair using pairing code and take note of the six-digit code provided. Once your device appears on the Pair devices over Wi-Fi window, you can select Pair and enter the six-digit code shown on your device.
Figure 4. Example of six-digit code entry.
After your device is paired, you can attempt to deploy your app to your device.
To pair a different device or to forget the current device on your workstation, navigate to Wireless debugging on your device. Tap your workstation name under Paired devices and select Forget .
If you want to quickly turn on and off wireless debugging, you can utilize the Quick settings developer tiles for Wireless debugging , found in Developer Options > Quick settings developer tiles .
Figure 5. The Quick settings developer tiles setting lets you quickly turn wireless debugging on and off.
Wi-Fi connection using command line
Alternatively, to connect to your device using command line without Android Studio, follow these steps:
Enable developer options on your device, as described earlier.
Enable Wireless debugging on your device, as described earlier.
On your workstation, open a terminal window and navigate to
android_sdk/platform-tools
.Find your IP address, port number, and pairing code by selecting Pair device with pairing code . Take note of the IP address, port number, and pairing code displayed on the device.
On your workstation's terminal, run
adb pair ipaddr:port
. Use the IP address and port number from above.When prompted, enter the pairing code, as shown below.
Figure 6. A message indicates that your device has been successfully paired.
Resolve wireless connection issues
If you are having issues connecting to your device wirelessly, try the following troubleshooting steps to resolve the issue.
Check whether your workstation and device meet the prerequisites
Check that the workstation and device meet the prerequisites listed at the beginning of this section .
Check for other known issues
The following is a list of current known issues with wireless debugging (with adb or Android Studio) and how to resolve them:
Wi-Fi is not connecting : Secure Wi-Fi networks, such as corporate Wi-Fi networks, may block p2p connections and not let you connect over Wi-Fi. Try connecting with a cable or another (non-corp) Wi-Fi network. Wireless connection using
adb connect ip : port
over tcp/ip (following an initial USB connection) is another option, in case resorting to a non-corp network is an option.adb
over Wi-Fi sometimes turns off automatically : This can happen if the device either switches Wi-Fi networks or disconnects from the network. To resolve, re-connect to the network.Device not connecting after pairing successfully :
adb
relies on mDNS to discover and automatically connect to paired devices. If your network or device configuration does not support mDNS or has disabled it, then you need to manually connect to the device usingadb connect ip : port
.
Connect wirelessly with a device after an initial USB connection (only option available on Android 10 and lower)
Note: This workflow is applicable also to Android 11 (and higher), the caveat being that it also involves an *initial* connection over physical USB.
Note: The following instructions do not apply to Wear devices running Android 10 (API level 29) or lower. See the guide about debugging a Wear OS app for more information.
adb
usually communicates with the device over USB, but you can also use adb
over Wi-Fi. To connect a device running Android 10 (API level 29) or lower, follow these initial steps over USB:
- Connect your Android device and
adb
host computer to a common Wi-Fi network. - Connect the device to the host computer with a USB cable.
- Set the target device to listen for a TCP/IP connection on port 5555:
adb tcpip 5555
- Disconnect the USB cable from the target device.
- Find the IP address of the Android device. For example, on a Nexus device, you can find the IP address at Settings > About tablet (or About phone ) > Status > IP address .
- Connect to the device by its IP address:
adb connect device_ip_address:5555
- Confirm that your host computer is connected to the target device:
$ adb devices List of devices attached device_ip_address:5555 device
Note: Beware that not all access points are suitable. You might need to use an access point whose firewall is configured properly to support adb
.
Your device is now connected to adb
.
If the adb
connection to your device is lost:
- Make sure that your host is still connected to the same Wi-Fi network as your Android device.
- Reconnect by executing the
adb connect
step again. - If that doesn't work, reset your
adb
host:adb kill-server
Then start over from the beginning.
Query for devices
Before issuing adb
commands, it is helpful to know what device instances are connected to the adb
server. Generate a list of attached devices using the devices
command:
adb devices -l
In response, adb
prints this status information for each device:
- Serial number:
adb
creates a string to uniquely identify the device by its port number. Here's an example serial number:emulator-5554
- State: The connection state of the device can be one of the following:
-
offline
: The device is not connected toadb
or is not responding. -
device
: The device is connected to theadb
server. Note that this state does not imply that the Android system is fully booted and operational, because the device connects toadb
while the system is still booting. After boot-up, this is the normal operational state of a device. -
no device
: There is no device connected.
-
- Description: If you include the
-l
option, thedevices
command tells you what the device is. This information is helpful when you have multiple devices connected so that you can tell them apart.
The following example shows the devices
command and its output. There are three devices running. The first two lines in the list are emulators, and the third line is a hardware device that is attached to the computer.
$ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo
Emulator not listed
The adb devices
command has a corner-case command sequence that causes running emulators to not show up in the adb devices
output even though the emulators are visible on your desktop. This happens when all of the following conditions are true:
- The
adb
server is not running. - You use the
emulator
command with the-port
or-ports
option with an odd-numbered port value between 5554 and 5584. - The odd-numbered port you chose is not busy, so the port connection can be made at the specified port number — or, if it is busy, the emulator switches to another port that meets the requirements in 2.
- You start the
adb
server after you start the emulator.
One way to avoid this situation is to let the emulator choose its own ports and to run no more than 16 emulators at once. Another way is to always start the adb
server before you use the emulator
command, as explained in the following examples.
Example 1: In the following command sequence, the adb devices
command starts the adb
server, but the list of devices does not appear.
Stop the adb
server and enter the following commands in the order shown. For the AVD name, provide a valid AVD name from your system. To get a list of AVD names, type emulator -list-avds
. The emulator
command is in the android_sdk /tools
directory.
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5555 $ adb devices List of devices attached * daemon not running. starting it now on port 5037 * * daemon started successfully *
Example 2: In the following command sequence, adb devices
displays the list of devices because the adb
server was started first.
To see the emulator in the adb devices
output, stop the adb
server, and then start it again after using the emulator
command and before using the adb devices
command, as follows:
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices List of devices attached emulator-5557 device
For more information about emulator command-line options, see Command-Line startup options .
Send commands to a specific device
If multiple devices are running, you must specify the target device when you issue the adb
command. To specify the target, follow these steps:
- Use the
devices
command to get the serial number of the target. - Once you have the serial number, use the
-s
option with theadb
commands to specify the serial number.- If you're going to issue a lot of
adb
commands, you can set the$ANDROID_SERIAL
environment variable to contain the serial number instead. - If you use both
-s
and$ANDROID_SERIAL
,-s
overrides$ANDROID_SERIAL
.
- If you're going to issue a lot of
In the following example, the list of attached devices is obtained, and then the serial number of one of the devices is used to install the helloWorld.apk
on that device:
$ adb devices List of devices attached emulator-5554 device emulator-5555 device 0.0.0.0:6520 device # To install on emulator-5555 $ adb -s emulator-5555 install helloWorld.apk # To install on 0.0.0.0:6520 $ adb -s 0.0.0.0:6520 install helloWorld.apk
Note: If you issue a command without specifying a target device when multiple devices are available, adb
displays an error "adb: more than one device/emulator".
If you have multiple devices available but only one is an emulator, use the -e
option to send commands to the emulator. If there are multiple devices but only one hardware device attached, use the -d
option to send commands to the hardware device.
একটি অ্যাপ ইনস্টল করুন
You can use adb
to install an APK on an emulator or connected device with the install
command:
adb install path_to_apk
You must use the -t
option with the install
command when you install a test APK. For more information, see -t
.
To install multiple APKs use install-multiple
. This is useful if you download all the APKs for a specific device for your app from the Play Console and want to install them on an emulator or physical device.
For more information about how to create an APK file that you can install on an emulator/device instance, see Build and run your app .
Note: If you are using Android Studio, you do not need to use adb
directly to install your app on the emulator or device. Instead, Android Studio handles the packaging and installation of the app for you.
পোর্ট ফরওয়ার্ডিং সেট আপ করুন
Use the forward
command to set up arbitrary port forwarding, which forwards requests on a specific host port to a different port on a device. The following example sets up forwarding of host port 6100 to device port 7100:
adb forward tcp:6100 tcp:7100
The following example sets up forwarding of host port 6100 to local:logd:
adb forward tcp:6100 local:logd
This could be useful if you are trying to detemine what is being sent to a given port on the device. All received data will be written to the system-logging daemon and displayed in the device logs.
Copy files to and from a device
Use the pull
and push
commands to copy files to and from a device. Unlike the install
command, which only copies an APK file to a specific location, the pull
and push
commands let you copy arbitrary directories and files to any location in a device.
To copy a file or directory and its sub-directories from the device, do the following:
adb pull remote local
To copy a file or directory and its sub-directories to the device, do the following:
adb push local remote
Replace local
and remote
with the paths to the target files/directory on your development machine (local) and on the device (remote). যেমন:
adb push myfile.txt /sdcard/myfile.txt
Stop the adb server
In some cases, you might need to terminate the adb
server process and then restart it to resolve the problem. For example, this could be the case if adb
does not respond to a command.
To stop the adb
server, use the adb kill-server
command. You can then restart the server by issuing any other adb
command.
Issue adb commands
Issue adb
commands from a command line on your development machine or from a script using the following:
adb [-d | -e | -s serial_number] command
If there's only one emulator running or only one device connected, the adb
command is sent to that device by default. If multiple emulators are running and/or multiple devices are attached, you need to use the -d
, -e
, or -s
option to specify the target device to which the command should be directed.
You can see a detailed list of all supported adb
commands using the following command:
adb --help
Issue shell commands
You can use the shell
command to issue device commands through adb
or to start an interactive shell. To issue a single command, use the shell
command like this:
adb [-d |-e | -s serial_number] shell shell_command
To start an interactive shell on a device, use the shell
command like this:
adb [-d | -e | -s serial_number] shell
To exit an interactive shell, press Control+D
or type exit
.
Android provides most of the usual Unix command-line tools. For a list of available tools, use the following command:
adb shell ls /system/bin
Help is available for most of the commands via the --help
argument. Many of the shell commands are provided by toybox . General help applicable to all toybox commands is available via toybox --help
.
With Android Platform Tools 23 and higher, adb
handles arguments the same way that the ssh(1)
command does. This change has fixed a lot of problems with command injection and makes it possible to safely execute commands that contain shell metacharacters , such as adb install Let\'sGo.apk
. This change means that the interpretation of any command that contains shell metacharacters has also changed.
For example, adb shell setprop key ' two words '
is now an error, because the quotes are swallowed by the local shell, and the device sees adb shell setprop key two words
. To make the command work, quote twice, once for the local shell and once for the remote shell, as you do with ssh(1)
. For example, adb shell setprop key "' two words '"
works because the local shell takes the outer level of quoting and the device still sees the inner level of quoting: setprop key 'two words'
. Escaping is also an option, but quoting twice is usually easier.
See also Logcat command-line tool , which is useful for monitoring the system log.
Call activity manager
Within an adb
shell, you can issue commands with the activity manager ( am
) tool to perform various system actions, such as start an activity, force-stop a process, broadcast an intent, modify the device screen properties, and more.
While in a shell, the am
syntax is:
am command
You can also issue an activity manager command directly from adb
without entering a remote shell. যেমন:
adb shell am start -a android.intent.action.VIEW
Table 1. Available activity manager commands
আদেশ | বর্ণনা |
---|---|
start [ options ] intent | Start an Activity specified by intent .See the Specification for intent arguments . বিকল্পগুলি হল:
|
startservice [ options ] intent | Start the Service specified by intent .See the Specification for intent arguments . বিকল্পগুলি হল:
|
force-stop package | Force-stop everything associated with package . |
kill [ options ] package | Kill all processes associated with package . This command kills only processes that are safe to kill and that will not impact the user experience.বিকল্পগুলি হল:
|
kill-all | Kill all background processes. |
broadcast [ options ] intent | Issue a broadcast intent. See the Specification for intent arguments . বিকল্পগুলি হল:
|
instrument [ options ] component | Start monitoring with an Instrumentation instance. Typically the target component is the form test_package / runner_class .বিকল্পগুলি হল:
|
profile start process file | Start profiler on process , write results to file . |
profile stop process | Stop profiler on process . |
dumpheap [ options ] process file | Dump the heap of process , write to file .বিকল্পগুলি হল:
|
dumpbitmaps [ options ] [-p process ] | Dump bitmap information from process (API level 36 and above).বিকল্পগুলি হল:
process is specified, bitmaps from all processes will be dumped. |
set-debug-app [ options ] package | Set app package to debug.বিকল্পগুলি হল:
|
clear-debug-app | Clear the package previous set for debugging with set-debug-app . |
monitor [ options ] | Start monitoring for crashes or ANRs. বিকল্পগুলি হল:
|
screen-compat {on | off} package | Control screen compatibility mode of package . |
display-size [reset | width x height ] | Override device display size. This command is helpful for testing your app across different screen sizes by mimicking a small screen resolution using a device with a large screen, and vice versa. উদাহরণ: |
display-density dpi | Override device display density. This command is helpful for testing your app across different screen densities by mimicking a high-density screen environment using a low-density screen, and vice versa. উদাহরণ: |
to-uri intent | Print the given intent specification as a URI. See the Specification for intent arguments . |
to-intent-uri intent | Print the given intent specification as an intent: URI.See the Specification for intent arguments . |
Specification for intent arguments
For activity manager commands that take an intent
argument, you can specify the intent with the following options:
Call package manager ( pm
)
Within an adb
shell, you can issue commands with the package manager ( pm
) tool to perform actions and queries on app packages installed on the device.
While in a shell, the pm
syntax is:
pm command
You can also issue a package manager command directly from adb
without entering a remote shell. যেমন:
adb shell pm uninstall com.example.MyApp
Table 2. Available package manager commands
আদেশ | বর্ণনা |
---|---|
list packages [ options ] filter | Print all packages, optionally only those whose package name contains the text in filter .বিকল্প:
|
list permission-groups | Print all known permission groups. |
list permissions [ options ] group | Print all known permissions, optionally only those in group .বিকল্প:
|
list instrumentation [ options ] | List all test packages. বিকল্প:
|
list features | Print all features of the system. |
list libraries | Print all the libraries supported by the current device. |
list users | Print all users on the system. |
path package | Print the path to the APK of the given package . |
install [ options ] path | Install a package, specified by path , to the system.বিকল্প:
|
uninstall [ options ] package | Removes a package from the system. বিকল্প:
|
clear package | Delete all data associated with a package. |
enable package_or_component | Enable the given package or component (written as "package/class"). |
disable package_or_component | Disable the given package or component (written as "package/class"). |
disable-user [ options ] package_or_component | বিকল্প:
|
grant package_name permission | Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. |
revoke package_name permission | Revoke a permission from an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. |
set-install-location location | Change the default install location. Location values:
Note: This is only intended for debugging. Using this can cause apps to break and other undesireable behavior. |
get-install-location | Returns the current install location. রিটার্ন মান:
|
set-permission-enforced permission [true | false] | Specify whether the given permission should be enforced. |
trim-caches desired_free_space | Trim cache files to reach the given free space. |
create-user user_name | Create a new user with the given user_name , printing the new user identifier of the user. |
remove-user user_id | Remove the user with the given user_id , deleting all data associated with that user |
get-max-users | Print the maximum number of users supported by the device. |
get-app-links [ options ] [ package ] | Print the domain verification state for the given package , or for all packages if none is specified. State codes are defined as follows:
বিকল্পগুলি হল:
|
reset-app-links [ options ] [ package ] | Reset domain verification state for the given package, or for all packages if none is specified.
বিকল্পগুলি হল:
|
verify-app-links [ --re-verify ] [ package ] | Broadcast a verification request for the given package , or for all packages if none is specified. Only sends if the package has previously not recorded a response.
|
set-app-links [--package package ] state domains | Manually set the state of a domain for a package. The domain must be declared by the package as autoVerify for this to work. This command will not report a failure for domains that could not be applied.
|
set-app-links-user-selection --user user_id [--package package ] enabled domains | Manually set the state of a host user selection for a package. The domain must be declared by the package for this to work. This command will not report a failure for domains that could not be applied.
|
set-app-links-allowed --user user_id [--package package ] allowed | Toggle the auto-verified link-handling setting for a package.
|
get-app-link-owners --user user_id [--package package ] domains | Print the owners for a specific domain for a given user in low- to high-priority order.
|
Call device policy manager ( dpm
)
To help you develop and test your device management apps, issue commands to the device policy manager ( dpm
) tool. Use the tool to control the active admin app or change a policy's status data on the device.
While in a shell, the dpm
syntax is:
dpm command
You can also issue a device policy manager command directly from adb
without entering a remote shell:
adb shell dpm command
Table 3. Available device policy manager commands
আদেশ | বর্ণনা |
---|---|
set-active-admin [ options ] component | Sets component as active admin. বিকল্পগুলি হল:
|
set-profile-owner [ options ] component | Set component as active admin and its package as profile owner for an existing user. বিকল্পগুলি হল:
|
set-device-owner [ options ] component | Set component as active admin and its package as device owner. বিকল্পগুলি হল:
|
remove-active-admin [ options ] component | Disable an active admin. The app must declare android:testOnly in the manifest. This command also removes device and profile owners.বিকল্পগুলি হল:
|
clear-freeze-period-record | Clear the device's record of previously set freeze periods for system OTA updates. This is useful to avoid the device scheduling restrictions when developing apps that manage freeze periods. See Manage system updates . Supported on devices running Android 9.0 (API level 28) and higher. |
force-network-logs | Force the system to make any existing network logs ready for retrieval by a DPC. If there are connection or DNS logs available, the DPC receives the onNetworkLogsAvailable() callback. See Network activity logging .This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. |
force-security-logs | Force the system to make any existing security logs available to the DPC. If there are logs available, the DPC receives the onSecurityLogsAvailable() callback. See Log enterprise device activity .This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. |
একটি স্ক্রিনশট নিন
The screencap
command is a shell utility for taking a screenshot of a device display.
While in a shell, the screencap
syntax is:
screencap filename
To use screencap
from the command line, enter the following:
adb shell screencap /sdcard/screen.png
Here's an example screenshot session, using the adb
shell to capture the screenshot and the pull
command to download the file from the device:
$ adb shell shell@ $ screencap /sdcard/screen.png shell@ $ exit $ adb pull /sdcard/screen.png
একটি ভিডিও রেকর্ড করুন
The screenrecord
command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file. You can use this file to create promotional or training videos or for debugging and testing.
In a shell, use the following syntax:
screenrecord [options] filename
To use screenrecord
from the command line, enter the following:
adb shell screenrecord /sdcard/demo.mp4
Stop the screen recording by pressing Control+C. Otherwise, the recording stops automatically at three minutes or the time limit set by --time-limit
.
To begin recording your device screen, run the screenrecord
command to record the video. Then, run the pull
command to download the video from the device to the host computer. Here's an example recording session:
$ adb shell shell@ $ screenrecord --verbose /sdcard/demo.mp4 (press Control + C to stop) shell@ $ exit $ adb pull /sdcard/demo.mp4
The screenrecord
utility can record at any supported resolution and bit rate you request, while retaining the aspect ratio of the device display. The utility records at the native display resolution and orientation by default, with a maximum length of three minutes.
Limitations of the screenrecord
utility:
- ভিডিও ফাইলের সাথে অডিও রেকর্ড করা হয় না।
- Video recording is not available for devices running Wear OS.
- Some devices might not be able to record at their native display resolution. If you encounter problems with screen recording, try using a lower screen resolution.
- Rotation of the screen during recording is not supported. If the screen does rotate during recording, some of the screen is cut off in the recording.
Table 4. screenrecord
options
অপশন | বর্ণনা |
---|---|
--help | Display command syntax and options |
--size width x height | Set the video size: 1280x720 . The default value is the device's native display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder. |
--bit-rate rate | Set the video bit rate for the video, in megabits per second. The default value is 20Mbps. আপনি ভিডিওর গুণমান উন্নত করতে বিট রেট বাড়াতে পারেন, কিন্তু এটি করার ফলে বড় মুভি ফাইল হয়। The following example sets the recording bit rate to 6Mbps: screenrecord --bit-rate 6000000 /sdcard/demo.mp4 |
--time-limit time | Set the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes). |
--rotate | Rotate the output 90 degrees. এই বৈশিষ্ট্যটি পরীক্ষামূলক। |
--verbose | Display log information on the command-line screen. If you do not set this option, the utility does not display any information while running. |
Read ART profiles for apps
Starting in Android 7.0 (API level 24), the Android Runtime (ART) collects execution profiles for installed apps, which are used to optimize app performance. Examine the collected profiles to understand which methods are executed frequently and which classes are used during app startup.
Note: It is only possible to retrieve the execution profile filename if you have root access to the file system, for example, on an emulator.
To produce a text form of the profile information, use the following command:
adb shell cmd package dump-profiles package
To retrieve the file produced, use:
adb pull /data/misc/profman/package.prof.txt
Reset test devices
If you test your app across multiple test devices, it may be useful to reset your device between tests, for example, to remove user data and reset the test environment. You can perform a factory reset of a test device running Android 10 (API level 29) or higher using the testharness
adb
shell command, as shown:
adb shell cmd testharness enable
When restoring the device using testharness
, the device automatically backs up the RSA key that allows debugging through the current workstation in a persistent location. That is, after the device is reset, the workstation can continue to debug and issue adb
commands to the device without manually registering a new key.
Additionally, to help make it easier and more secure to keep testing your app, using the testharness
to restore a device also changes the following device settings:
- The device sets up certain system settings so that initial device setup wizards do not appear. That is, the device enters a state from which you can quickly install, debug, and test your app.
- সেটিংস:
- Disables lock screen.
- Disables emergency alerts.
- Disables auto-sync for accounts.
- Disables automatic system updates.
- অন্যান্য:
- Disables preinstalled security apps.
If your app needs to detect and adapt to the default settings of the testharness
command, use the ActivityManager.isRunningInUserTestHarness()
.
sqlite
sqlite3
starts the sqlite
command-line program for examining SQLite databases. It includes commands such as .dump
to print the contents of a table and .schema
to print the SQL CREATE
statement for an existing table. You can also execute SQLite commands from the command line, as shown:
$ adb -s emulator-5554 shell $ sqlite3 /data/data/com.example.app/databases/rssitems.db SQLite version 3.3.12 Enter ".help" for instructions
Note: It is only possible to access a SQLite database if you have root access to the file system, for example, on an emulator.
For more information, see the sqlite3
command line documentation .
adb USB backends
The adb server can interact with the USB stack through two backends. It can either use the native backend of the OS (Windows, Linux, or macOS) or it can use the libusb
backend. Some features, such as attach
, detach
, and USB speed detection, are only available when using libusb
backend.
You can choose a backend by using the ADB_LIBUSB
environment variable. If it isn't set, adb uses its default backend. The default behavior varies among OS. Starting with ADB v34 , the liubusb
backend is used by default on all OS except Windows, where the native backend is used by default. If ADB_LIBUSB
is set, it determines whether the native backend or libusb
is used. See the adb manual page for more information about adb environment variables.
adb mDNS backends
ADB can use the multicast DNS protocol to automatically connect the server and devices. The ADB server ships with two backends, Bonjour (Apple's mdnsResponder) and Openscreen.
The Bonjour backend needs a daemon to be running on the host machine. On macOS Apple's built-in daemon is always running, but on Windows and Linux, the user must make sure the mdnsd
daemon is up and running. If the command adb mdns check
returns an error, it is likely that ADB is using the Bonjour backend but there is no Bonjour daemon running.
The Openscreen backend does not need a daemon to be running on the machine. Support for the Openscreen backend on macOS starts at ADB v35. Windows and Linux are supported as of ADB v34.
By default ADB uses the Bonjour backend. This behavior can be changed using the environment variable ADB_MDNS_OPENSCREEN
(set to 1
or 0
). See the ADB manual page for further details.
adb Burst Mode (starting with ADB 36.0.0)
Burst Mode is an experimental feature that lets ADB to keep on sending packets to a device even before the device has responded to the previous packet. This greatly increases the throughput of ADB when transferring large files and also reduces latency while debugging.
Burst Mode is disabled by default. To enable the feature, do one of the following:
- Set the environment variable
ADB_DELAYED_ACK
to1
. - In Android Studio, go to the debugger settings at File (or Android Studio on macOS) > Settings > Build, Execution, Deployment > Debugger and set ADB Server Burst Mode to Enabled .
অ্যান্ড্রয়েড ডিবাগ ব্রিজ ( adb
) একটি বহুমুখী কমান্ড-লাইন টুল যা আপনাকে একটি ডিভাইসের সাথে যোগাযোগ করতে দেয়। The adb
command facilitates a variety of device actions, such as installing and debugging apps. adb
provides access to a Unix shell that you can use to run a variety of commands on a device. এটি একটি ক্লায়েন্ট-সার্ভার প্রোগ্রাম যা তিনটি উপাদান অন্তর্ভুক্ত করে:
- A client , which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an
adb
command. - A daemon (adbd) , which runs commands on a device. The daemon runs as a background process on each device.
- A server , which manages communication between the client and the daemon. The server runs as a background process on your development machine.
adb
is included in the Android SDK Platform Tools package. Download this package with the SDK Manager , which installs it at android_sdk /platform-tools/
. If you want the standalone Android SDK Platform Tools package, download it here .
For information on connecting a device for use over adb
, including how to use the Connection Assistant to troubleshoot common problems, see Run apps on a hardware device .
How adb works
When you start an adb
client, the client first checks whether there is an adb
server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb
clients.
Note: All adb
clients use port 5037 to communicate with the adb
server.
The server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range 5555 to 5585, which is the range used by the first 16 emulators. Where the server finds an adb
daemon (adbd), it sets up a connection to that port.
Each emulator uses a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb
connections. যেমন:
Emulator 1, console: 5554
Emulator 1, adb
: 5555
Emulator 2, console: 5556
Emulator 2, adb
: 5557
এবং তাই
As shown, the emulator connected to adb
on port 5555 is the same as the emulator whose console listens on port 5554.
Once the server has set up connections to all devices, you can use adb
commands to access those devices. Because the server manages connections to devices and handles commands from multiple adb
clients, you can control any device from any client or from a script.
Enable adb debugging on your device
To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options . On Android 4.2 (API level 17) and higher, the Developer options screen is hidden by default. To make it visible, enable Developer options.
You can now connect your device with USB. You can verify that your device is connected by executing adb devices
from the android_sdk /platform-tools/
directory. If connected, you'll see the device name listed as a "device."
Note: When you connect a device running Android 4.2.2 (API level 17) or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog.
For more information about connecting to a device over USB, read Run apps on a hardware device .
Connect to a device over Wi-Fi
Note: The instructions below do not apply to Wear devices running Android 11 (API level 30). See the guide to debugging a Wear OS app for more information.
Android 11 (API level 30) and higher support deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without ever needing to physically connect your device via USB. এটি ড্রাইভার ইনস্টলেশনের মতো সাধারণ USB সংযোগ সমস্যাগুলি মোকাবেলা করার প্রয়োজনীয়তা দূর করে।
Before you begin using wireless debugging, do the following:
আপনার ওয়ার্কস্টেশন এবং ডিভাইস একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত আছে তা নিশ্চিত করুন।
Ensure that your device is running Android 11 (API level 30) or higher for phone or Android 13 (API level 33) or higher for TV and WearOS. আরও তথ্যের জন্য, আপনার অ্যান্ড্রয়েড সংস্করণ দেখুন এবং আপডেট করুন ।
If using the IDE, ensure that you have the latest version of Android Studio installed. আপনি এখানে এটি ডাউনলোড করতে পারেন.
On your workstation, update to the latest version of the SDK Platform Tools .
To use wireless debugging, you must pair your device to your workstation using a QR code or a pairing code. আপনার ওয়ার্কস্টেশন এবং ডিভাইস অবশ্যই একই ওয়্যারলেস নেটওয়ার্কের সাথে সংযুক্ত থাকতে হবে। আপনার ডিভাইসের সাথে সংযোগ করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
Enable developer options on your device.
Open Android Studio and select Pair Devices Using Wi-Fi from the run configurations menu.
Figure 1. Run configurations menu.The Pair devices over Wi-Fi window pops up, as shown in figure 2.
Figure 2. Popup window to pair devices using QR code or pairing code.On your device, tap Wireless debugging and pair your device:
Figure 3. Screenshot of the Wireless debugging setting on a Google Pixel phone.To pair your device with a QR code, select Pair device with QR code and scan the QR code obtained from the Pair devices over Wi-Fi popup shown in figure 2.
To pair your device with a pairing code, select Pair device with pairing code from the Pair devices over Wi-Fi popup. On your device, select Pair using pairing code and take note of the six-digit code provided. Once your device appears on the Pair devices over Wi-Fi window, you can select Pair and enter the six-digit code shown on your device.
Figure 4. Example of six-digit code entry.
After your device is paired, you can attempt to deploy your app to your device.
To pair a different device or to forget the current device on your workstation, navigate to Wireless debugging on your device. Tap your workstation name under Paired devices and select Forget .
If you want to quickly turn on and off wireless debugging, you can utilize the Quick settings developer tiles for Wireless debugging , found in Developer Options > Quick settings developer tiles .
Figure 5. The Quick settings developer tiles setting lets you quickly turn wireless debugging on and off.
Wi-Fi connection using command line
Alternatively, to connect to your device using command line without Android Studio, follow these steps:
Enable developer options on your device, as described earlier.
Enable Wireless debugging on your device, as described earlier.
On your workstation, open a terminal window and navigate to
android_sdk/platform-tools
.Find your IP address, port number, and pairing code by selecting Pair device with pairing code . Take note of the IP address, port number, and pairing code displayed on the device.
On your workstation's terminal, run
adb pair ipaddr:port
. Use the IP address and port number from above.When prompted, enter the pairing code, as shown below.
Figure 6. A message indicates that your device has been successfully paired.
Resolve wireless connection issues
If you are having issues connecting to your device wirelessly, try the following troubleshooting steps to resolve the issue.
Check whether your workstation and device meet the prerequisites
Check that the workstation and device meet the prerequisites listed at the beginning of this section .
Check for other known issues
The following is a list of current known issues with wireless debugging (with adb or Android Studio) and how to resolve them:
Wi-Fi is not connecting : Secure Wi-Fi networks, such as corporate Wi-Fi networks, may block p2p connections and not let you connect over Wi-Fi. Try connecting with a cable or another (non-corp) Wi-Fi network. Wireless connection using
adb connect ip : port
over tcp/ip (following an initial USB connection) is another option, in case resorting to a non-corp network is an option.adb
over Wi-Fi sometimes turns off automatically : This can happen if the device either switches Wi-Fi networks or disconnects from the network. To resolve, re-connect to the network.Device not connecting after pairing successfully :
adb
relies on mDNS to discover and automatically connect to paired devices. If your network or device configuration does not support mDNS or has disabled it, then you need to manually connect to the device usingadb connect ip : port
.
Connect wirelessly with a device after an initial USB connection (only option available on Android 10 and lower)
Note: This workflow is applicable also to Android 11 (and higher), the caveat being that it also involves an *initial* connection over physical USB.
Note: The following instructions do not apply to Wear devices running Android 10 (API level 29) or lower. See the guide about debugging a Wear OS app for more information.
adb
usually communicates with the device over USB, but you can also use adb
over Wi-Fi. To connect a device running Android 10 (API level 29) or lower, follow these initial steps over USB:
- Connect your Android device and
adb
host computer to a common Wi-Fi network. - Connect the device to the host computer with a USB cable.
- Set the target device to listen for a TCP/IP connection on port 5555:
adb tcpip 5555
- Disconnect the USB cable from the target device.
- Find the IP address of the Android device. For example, on a Nexus device, you can find the IP address at Settings > About tablet (or About phone ) > Status > IP address .
- Connect to the device by its IP address:
adb connect device_ip_address:5555
- Confirm that your host computer is connected to the target device:
$ adb devices List of devices attached device_ip_address:5555 device
Note: Beware that not all access points are suitable. You might need to use an access point whose firewall is configured properly to support adb
.
Your device is now connected to adb
.
If the adb
connection to your device is lost:
- Make sure that your host is still connected to the same Wi-Fi network as your Android device.
- Reconnect by executing the
adb connect
step again. - If that doesn't work, reset your
adb
host:adb kill-server
Then start over from the beginning.
Query for devices
Before issuing adb
commands, it is helpful to know what device instances are connected to the adb
server. Generate a list of attached devices using the devices
command:
adb devices -l
In response, adb
prints this status information for each device:
- Serial number:
adb
creates a string to uniquely identify the device by its port number. Here's an example serial number:emulator-5554
- State: The connection state of the device can be one of the following:
-
offline
: The device is not connected toadb
or is not responding. -
device
: The device is connected to theadb
server. Note that this state does not imply that the Android system is fully booted and operational, because the device connects toadb
while the system is still booting. After boot-up, this is the normal operational state of a device. -
no device
: There is no device connected.
-
- Description: If you include the
-l
option, thedevices
command tells you what the device is. This information is helpful when you have multiple devices connected so that you can tell them apart.
The following example shows the devices
command and its output. There are three devices running. The first two lines in the list are emulators, and the third line is a hardware device that is attached to the computer.
$ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo
Emulator not listed
The adb devices
command has a corner-case command sequence that causes running emulators to not show up in the adb devices
output even though the emulators are visible on your desktop. This happens when all of the following conditions are true:
- The
adb
server is not running. - You use the
emulator
command with the-port
or-ports
option with an odd-numbered port value between 5554 and 5584. - The odd-numbered port you chose is not busy, so the port connection can be made at the specified port number — or, if it is busy, the emulator switches to another port that meets the requirements in 2.
- You start the
adb
server after you start the emulator.
One way to avoid this situation is to let the emulator choose its own ports and to run no more than 16 emulators at once. Another way is to always start the adb
server before you use the emulator
command, as explained in the following examples.
Example 1: In the following command sequence, the adb devices
command starts the adb
server, but the list of devices does not appear.
Stop the adb
server and enter the following commands in the order shown. For the AVD name, provide a valid AVD name from your system. To get a list of AVD names, type emulator -list-avds
. The emulator
command is in the android_sdk /tools
directory.
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5555 $ adb devices List of devices attached * daemon not running. starting it now on port 5037 * * daemon started successfully *
Example 2: In the following command sequence, adb devices
displays the list of devices because the adb
server was started first.
To see the emulator in the adb devices
output, stop the adb
server, and then start it again after using the emulator
command and before using the adb devices
command, as follows:
$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices List of devices attached emulator-5557 device
For more information about emulator command-line options, see Command-Line startup options .
Send commands to a specific device
If multiple devices are running, you must specify the target device when you issue the adb
command. To specify the target, follow these steps:
- Use the
devices
command to get the serial number of the target. - Once you have the serial number, use the
-s
option with theadb
commands to specify the serial number.- If you're going to issue a lot of
adb
commands, you can set the$ANDROID_SERIAL
environment variable to contain the serial number instead. - If you use both
-s
and$ANDROID_SERIAL
,-s
overrides$ANDROID_SERIAL
.
- If you're going to issue a lot of
In the following example, the list of attached devices is obtained, and then the serial number of one of the devices is used to install the helloWorld.apk
on that device:
$ adb devices List of devices attached emulator-5554 device emulator-5555 device 0.0.0.0:6520 device # To install on emulator-5555 $ adb -s emulator-5555 install helloWorld.apk # To install on 0.0.0.0:6520 $ adb -s 0.0.0.0:6520 install helloWorld.apk
Note: If you issue a command without specifying a target device when multiple devices are available, adb
displays an error "adb: more than one device/emulator".
If you have multiple devices available but only one is an emulator, use the -e
option to send commands to the emulator. If there are multiple devices but only one hardware device attached, use the -d
option to send commands to the hardware device.
একটি অ্যাপ ইনস্টল করুন
You can use adb
to install an APK on an emulator or connected device with the install
command:
adb install path_to_apk
You must use the -t
option with the install
command when you install a test APK. For more information, see -t
.
To install multiple APKs use install-multiple
. This is useful if you download all the APKs for a specific device for your app from the Play Console and want to install them on an emulator or physical device.
For more information about how to create an APK file that you can install on an emulator/device instance, see Build and run your app .
Note: If you are using Android Studio, you do not need to use adb
directly to install your app on the emulator or device. Instead, Android Studio handles the packaging and installation of the app for you.
পোর্ট ফরওয়ার্ডিং সেট আপ করুন
Use the forward
command to set up arbitrary port forwarding, which forwards requests on a specific host port to a different port on a device. The following example sets up forwarding of host port 6100 to device port 7100:
adb forward tcp:6100 tcp:7100
The following example sets up forwarding of host port 6100 to local:logd:
adb forward tcp:6100 local:logd
This could be useful if you are trying to detemine what is being sent to a given port on the device. All received data will be written to the system-logging daemon and displayed in the device logs.
Copy files to and from a device
Use the pull
and push
commands to copy files to and from a device. Unlike the install
command, which only copies an APK file to a specific location, the pull
and push
commands let you copy arbitrary directories and files to any location in a device.
To copy a file or directory and its sub-directories from the device, do the following:
adb pull remote local
To copy a file or directory and its sub-directories to the device, do the following:
adb push local remote
Replace local
and remote
with the paths to the target files/directory on your development machine (local) and on the device (remote). যেমন:
adb push myfile.txt /sdcard/myfile.txt
Stop the adb server
In some cases, you might need to terminate the adb
server process and then restart it to resolve the problem. For example, this could be the case if adb
does not respond to a command.
To stop the adb
server, use the adb kill-server
command. You can then restart the server by issuing any other adb
command.
Issue adb commands
Issue adb
commands from a command line on your development machine or from a script using the following:
adb [-d | -e | -s serial_number] command
If there's only one emulator running or only one device connected, the adb
command is sent to that device by default. If multiple emulators are running and/or multiple devices are attached, you need to use the -d
, -e
, or -s
option to specify the target device to which the command should be directed.
You can see a detailed list of all supported adb
commands using the following command:
adb --help
Issue shell commands
You can use the shell
command to issue device commands through adb
or to start an interactive shell. To issue a single command, use the shell
command like this:
adb [-d |-e | -s serial_number] shell shell_command
To start an interactive shell on a device, use the shell
command like this:
adb [-d | -e | -s serial_number] shell
To exit an interactive shell, press Control+D
or type exit
.
Android provides most of the usual Unix command-line tools. For a list of available tools, use the following command:
adb shell ls /system/bin
Help is available for most of the commands via the --help
argument. Many of the shell commands are provided by toybox . General help applicable to all toybox commands is available via toybox --help
.
With Android Platform Tools 23 and higher, adb
handles arguments the same way that the ssh(1)
command does. This change has fixed a lot of problems with command injection and makes it possible to safely execute commands that contain shell metacharacters , such as adb install Let\'sGo.apk
. This change means that the interpretation of any command that contains shell metacharacters has also changed.
For example, adb shell setprop key ' two words '
is now an error, because the quotes are swallowed by the local shell, and the device sees adb shell setprop key two words
. To make the command work, quote twice, once for the local shell and once for the remote shell, as you do with ssh(1)
. For example, adb shell setprop key "' two words '"
works because the local shell takes the outer level of quoting and the device still sees the inner level of quoting: setprop key 'two words'
. Escaping is also an option, but quoting twice is usually easier.
See also Logcat command-line tool , which is useful for monitoring the system log.
Call activity manager
Within an adb
shell, you can issue commands with the activity manager ( am
) tool to perform various system actions, such as start an activity, force-stop a process, broadcast an intent, modify the device screen properties, and more.
While in a shell, the am
syntax is:
am command
You can also issue an activity manager command directly from adb
without entering a remote shell. যেমন:
adb shell am start -a android.intent.action.VIEW
Table 1. Available activity manager commands
আদেশ | বর্ণনা |
---|---|
start [ options ] intent | Start an Activity specified by intent .See the Specification for intent arguments . বিকল্পগুলি হল:
|
startservice [ options ] intent | Start the Service specified by intent .See the Specification for intent arguments . বিকল্পগুলি হল:
|
force-stop package | Force-stop everything associated with package . |
kill [ options ] package | Kill all processes associated with package . This command kills only processes that are safe to kill and that will not impact the user experience.বিকল্পগুলি হল:
|
kill-all | Kill all background processes. |
broadcast [ options ] intent | Issue a broadcast intent. See the Specification for intent arguments . বিকল্পগুলি হল:
|
instrument [ options ] component | Start monitoring with an Instrumentation instance. Typically the target component is the form test_package / runner_class .বিকল্পগুলি হল:
|
profile start process file | Start profiler on process , write results to file . |
profile stop process | Stop profiler on process . |
dumpheap [ options ] process file | Dump the heap of process , write to file .বিকল্পগুলি হল:
|
dumpbitmaps [ options ] [-p process ] | Dump bitmap information from process (API level 36 and above).বিকল্পগুলি হল:
process is specified, bitmaps from all processes will be dumped. |
set-debug-app [ options ] package | Set app package to debug.বিকল্পগুলি হল:
|
clear-debug-app | Clear the package previous set for debugging with set-debug-app . |
monitor [ options ] | Start monitoring for crashes or ANRs. বিকল্পগুলি হল:
|
screen-compat {on | off} package | Control screen compatibility mode of package . |
display-size [reset | width x height ] | Override device display size. This command is helpful for testing your app across different screen sizes by mimicking a small screen resolution using a device with a large screen, and vice versa. উদাহরণ: |
display-density dpi | Override device display density. This command is helpful for testing your app across different screen densities by mimicking a high-density screen environment using a low-density screen, and vice versa. উদাহরণ: |
to-uri intent | Print the given intent specification as a URI. See the Specification for intent arguments . |
to-intent-uri intent | Print the given intent specification as an intent: URI.See the Specification for intent arguments . |
Specification for intent arguments
For activity manager commands that take an intent
argument, you can specify the intent with the following options:
Call package manager ( pm
)
Within an adb
shell, you can issue commands with the package manager ( pm
) tool to perform actions and queries on app packages installed on the device.
While in a shell, the pm
syntax is:
pm command
You can also issue a package manager command directly from adb
without entering a remote shell. যেমন:
adb shell pm uninstall com.example.MyApp
Table 2. Available package manager commands
আদেশ | বর্ণনা |
---|---|
list packages [ options ] filter | Print all packages, optionally only those whose package name contains the text in filter .বিকল্প:
|
list permission-groups | Print all known permission groups. |
list permissions [ options ] group | Print all known permissions, optionally only those in group .বিকল্প:
|
list instrumentation [ options ] | List all test packages. বিকল্প:
|
list features | Print all features of the system. |
list libraries | Print all the libraries supported by the current device. |
list users | Print all users on the system. |
path package | Print the path to the APK of the given package . |
install [ options ] path | Install a package, specified by path , to the system.বিকল্প:
|
uninstall [ options ] package | Removes a package from the system. বিকল্প:
|
clear package | Delete all data associated with a package. |
enable package_or_component | Enable the given package or component (written as "package/class"). |
disable package_or_component | Disable the given package or component (written as "package/class"). |
disable-user [ options ] package_or_component | বিকল্প:
|
grant package_name permission | Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. |
revoke package_name permission | Revoke a permission from an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. |
set-install-location location | Change the default install location. Location values:
Note: This is only intended for debugging. Using this can cause apps to break and other undesireable behavior. |
get-install-location | Returns the current install location. রিটার্ন মান:
|
set-permission-enforced permission [true | false] | Specify whether the given permission should be enforced. |
trim-caches desired_free_space | Trim cache files to reach the given free space. |
create-user user_name | Create a new user with the given user_name , printing the new user identifier of the user. |
remove-user user_id | Remove the user with the given user_id , deleting all data associated with that user |
get-max-users | Print the maximum number of users supported by the device. |
get-app-links [ options ] [ package ] | Print the domain verification state for the given package , or for all packages if none is specified. State codes are defined as follows:
বিকল্পগুলি হল:
|
reset-app-links [ options ] [ package ] | Reset domain verification state for the given package, or for all packages if none is specified.
বিকল্পগুলি হল:
|
verify-app-links [ --re-verify ] [ package ] | Broadcast a verification request for the given package , or for all packages if none is specified. Only sends if the package has previously not recorded a response.
|
set-app-links [--package package ] state domains | Manually set the state of a domain for a package. The domain must be declared by the package as autoVerify for this to work. This command will not report a failure for domains that could not be applied.
|
set-app-links-user-selection --user user_id [--package package ] enabled domains | Manually set the state of a host user selection for a package. The domain must be declared by the package for this to work. This command will not report a failure for domains that could not be applied.
|
set-app-links-allowed --user user_id [--package package ] allowed | Toggle the auto-verified link-handling setting for a package.
|
get-app-link-owners --user user_id [--package package ] domains | Print the owners for a specific domain for a given user in low- to high-priority order.
|
Call device policy manager ( dpm
)
To help you develop and test your device management apps, issue commands to the device policy manager ( dpm
) tool. Use the tool to control the active admin app or change a policy's status data on the device.
While in a shell, the dpm
syntax is:
dpm command
You can also issue a device policy manager command directly from adb
without entering a remote shell:
adb shell dpm command
Table 3. Available device policy manager commands
আদেশ | বর্ণনা |
---|---|
set-active-admin [ options ] component | Sets component as active admin. বিকল্পগুলি হল:
|
set-profile-owner [ options ] component | Set component as active admin and its package as profile owner for an existing user. বিকল্পগুলি হল:
|
set-device-owner [ options ] component | Set component as active admin and its package as device owner. বিকল্পগুলি হল:
|
remove-active-admin [ options ] component | Disable an active admin. The app must declare android:testOnly in the manifest. This command also removes device and profile owners.বিকল্পগুলি হল:
|
clear-freeze-period-record | Clear the device's record of previously set freeze periods for system OTA updates. This is useful to avoid the device scheduling restrictions when developing apps that manage freeze periods. See Manage system updates . Supported on devices running Android 9.0 (API level 28) and higher. |
force-network-logs | Force the system to make any existing network logs ready for retrieval by a DPC. If there are connection or DNS logs available, the DPC receives the onNetworkLogsAvailable() callback. See Network activity logging .This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. |
force-security-logs | Force the system to make any existing security logs available to the DPC. If there are logs available, the DPC receives the onSecurityLogsAvailable() callback. See Log enterprise device activity .This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. |
একটি স্ক্রিনশট নিন
The screencap
command is a shell utility for taking a screenshot of a device display.
While in a shell, the screencap
syntax is:
screencap filename
To use screencap
from the command line, enter the following:
adb shell screencap /sdcard/screen.png
Here's an example screenshot session, using the adb
shell to capture the screenshot and the pull
command to download the file from the device:
$ adb shell shell@ $ screencap /sdcard/screen.png shell@ $ exit $ adb pull /sdcard/screen.png
একটি ভিডিও রেকর্ড করুন
The screenrecord
command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file. You can use this file to create promotional or training videos or for debugging and testing.
In a shell, use the following syntax:
screenrecord [options] filename
To use screenrecord
from the command line, enter the following:
adb shell screenrecord /sdcard/demo.mp4
Stop the screen recording by pressing Control+C. Otherwise, the recording stops automatically at three minutes or the time limit set by --time-limit
.
To begin recording your device screen, run the screenrecord
command to record the video. Then, run the pull
command to download the video from the device to the host computer. Here's an example recording session:
$ adb shell shell@ $ screenrecord --verbose /sdcard/demo.mp4 (press Control + C to stop) shell@ $ exit $ adb pull /sdcard/demo.mp4
The screenrecord
utility can record at any supported resolution and bit rate you request, while retaining the aspect ratio of the device display. The utility records at the native display resolution and orientation by default, with a maximum length of three minutes.
Limitations of the screenrecord
utility:
- ভিডিও ফাইলের সাথে অডিও রেকর্ড করা হয় না।
- Video recording is not available for devices running Wear OS.
- Some devices might not be able to record at their native display resolution. If you encounter problems with screen recording, try using a lower screen resolution.
- Rotation of the screen during recording is not supported. If the screen does rotate during recording, some of the screen is cut off in the recording.
Table 4. screenrecord
options
অপশন | বর্ণনা |
---|---|
--help | Display command syntax and options |
--size width x height | Set the video size: 1280x720 . The default value is the device's native display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder. |
--bit-rate rate | Set the video bit rate for the video, in megabits per second. The default value is 20Mbps. আপনি ভিডিওর গুণমান উন্নত করতে বিট রেট বাড়াতে পারেন, কিন্তু এটি করার ফলে বড় মুভি ফাইল হয়। The following example sets the recording bit rate to 6Mbps: screenrecord --bit-rate 6000000 /sdcard/demo.mp4 |
--time-limit time | Set the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes). |
--rotate | Rotate the output 90 degrees. এই বৈশিষ্ট্যটি পরীক্ষামূলক। |
--verbose | Display log information on the command-line screen. If you do not set this option, the utility does not display any information while running. |
Read ART profiles for apps
Starting in Android 7.0 (API level 24), the Android Runtime (ART) collects execution profiles for installed apps, which are used to optimize app performance. Examine the collected profiles to understand which methods are executed frequently and which classes are used during app startup.
Note: It is only possible to retrieve the execution profile filename if you have root access to the file system, for example, on an emulator.
To produce a text form of the profile information, use the following command:
adb shell cmd package dump-profiles package
To retrieve the file produced, use:
adb pull /data/misc/profman/package.prof.txt
Reset test devices
If you test your app across multiple test devices, it may be useful to reset your device between tests, for example, to remove user data and reset the test environment. You can perform a factory reset of a test device running Android 10 (API level 29) or higher using the testharness
adb
shell command, as shown:
adb shell cmd testharness enable
When restoring the device using testharness
, the device automatically backs up the RSA key that allows debugging through the current workstation in a persistent location. That is, after the device is reset, the workstation can continue to debug and issue adb
commands to the device without manually registering a new key.
Additionally, to help make it easier and more secure to keep testing your app, using the testharness
to restore a device also changes the following device settings:
- The device sets up certain system settings so that initial device setup wizards do not appear. That is, the device enters a state from which you can quickly install, debug, and test your app.
- সেটিংস:
- Disables lock screen.
- Disables emergency alerts.
- Disables auto-sync for accounts.
- Disables automatic system updates.
- অন্যান্য:
- Disables preinstalled security apps.
If your app needs to detect and adapt to the default settings of the testharness
command, use the ActivityManager.isRunningInUserTestHarness()
.
sqlite
sqlite3
starts the sqlite
command-line program for examining SQLite databases. It includes commands such as .dump
to print the contents of a table and .schema
to print the SQL CREATE
statement for an existing table. You can also execute SQLite commands from the command line, as shown:
$ adb -s emulator-5554 shell $ sqlite3 /data/data/com.example.app/databases/rssitems.db SQLite version 3.3.12 Enter ".help" for instructions
Note: It is only possible to access a SQLite database if you have root access to the file system, for example, on an emulator.
For more information, see the sqlite3
command line documentation .
adb USB backends
The adb server can interact with the USB stack through two backends. It can either use the native backend of the OS (Windows, Linux, or macOS) or it can use the libusb
backend. Some features, such as attach
, detach
, and USB speed detection, are only available when using libusb
backend.
You can choose a backend by using the ADB_LIBUSB
environment variable. If it isn't set, adb uses its default backend. The default behavior varies among OS. Starting with ADB v34 , the liubusb
backend is used by default on all OS except Windows, where the native backend is used by default. If ADB_LIBUSB
is set, it determines whether the native backend or libusb
is used. See the adb manual page for more information about adb environment variables.
adb mDNS backends
ADB can use the multicast DNS protocol to automatically connect the server and devices. The ADB server ships with two backends, Bonjour (Apple's mdnsResponder) and Openscreen.
The Bonjour backend needs a daemon to be running on the host machine. On macOS Apple's built-in daemon is always running, but on Windows and Linux, the user must make sure the mdnsd
daemon is up and running. If the command adb mdns check
returns an error, it is likely that ADB is using the Bonjour backend but there is no Bonjour daemon running.
The Openscreen backend does not need a daemon to be running on the machine. Support for the Openscreen backend on macOS starts at ADB v35. Windows and Linux are supported as of ADB v34.
By default ADB uses the Bonjour backend. This behavior can be changed using the environment variable ADB_MDNS_OPENSCREEN
(set to 1
or 0
). See the ADB manual page for further details.
adb Burst Mode (starting with ADB 36.0.0)
Burst Mode is an experimental feature that lets ADB to keep on sending packets to a device even before the device has responded to the previous packet. This greatly increases the throughput of ADB when transferring large files and also reduces latency while debugging.
Burst Mode is disabled by default. To enable the feature, do one of the following:
- Set the environment variable
ADB_DELAYED_ACK
to1
. - In Android Studio, go to the debugger settings at File (or Android Studio on macOS) > Settings > Build, Execution, Deployment > Debugger and set ADB Server Burst Mode to Enabled .